2017 © Pedro Peláez
 

library geocoder-php-nationaal-georegister-provider

Nationaal Georegister provider for Geocoder PHP

image

swisnl/geocoder-php-nationaal-georegister-provider

Nationaal Georegister provider for Geocoder PHP

  • Tuesday, February 27, 2018
  • by swisnl
  • Repository
  • 2 Watchers
  • 3 Stars
  • 940 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 4 Versions
  • 73 % Grown

The README.md

PDOK (formerly Nationaal Georegister) provider for Geocoder PHP

PHP from Packagist Latest Version on Packagist Software License Buy us a tree Build Status Coverage Status Quality Score Total Downloads Made by SWIS, (*1)

This is the PDOK (formerly Nationaal Georegister) provider for the PHP Geocoder, which uses the PDOK Locatieserver v3 (Dutch). It can geocode addresses (not IP addresses) and reverse geocode coordinates., (*2)

Please note that this provider can only (reverse) geocode addresses in The Netherlands!, (*3)

Install

Via Composer, (*4)

``` bash $ composer require swisnl/geocoder-php-nationaal-georegister-provider, (*5)


### HTTP Client PHP Geocoder is decoupled from any HTTP messaging client with the help of [PSR-18 HTTP Client](https://www.php-fig.org/psr/psr-18/). This requires another package providing [psr/http-client-implementation](https://packagist.org/providers/psr/http-client-implementation). To use Guzzle 7, for example, simply require `guzzlehttp/guzzle`: ``` bash $ composer require guzzlehttp/guzzle

Usage

``` php // Create geocoder $client = new \GuzzleHttp\Client(); $geocoder = new \Swis\Geocoder\NationaalGeoregister\NationaalGeoregister($client);, (*6)

// Geocode! $query = \Geocoder\Query\GeocodeQuery::create(...); $result = $geocoder->geocodeQuery($query);, (*7)


Please see [PHP Geocoder documentation](http://geocoder-php.org/Geocoder/) for more information about using PHP Geocoder with this provider. ### Options This provider accepts extra options in the constructor, or as query data. These options are directly passed to the Locatieserver, which accepts the following options: | Option | Description | Default | Customizable in this provider | | ------- | ---------------------- | ------- | ----------------------------- | | bq | Boost query | "type:gemeente^0.5 type:woonplaats^0.5 type:weg^1.0 type:postcode^1.5 type:adres^1.5" | yes | | df | Default field | - | yes | | fl | Field list | All fields used by this provider | no | | fq | Filter query | - | yes | | lat&lon | Latitude and longitude | Coordinates from `\Geocoder\Query\ReverseQuery` when reverse geocoding | only for geocoding | | q | Search term | Text from `\Geocoder\Query\GeocodeQuery` when geocoding | no | | rows | Amount of rows | Limit from query | no | | start | Page (starting at 0) | - | yes | | sort | Sorting | See [Locatieserver documentation (Dutch)](https://github.com/PDOK/locatieserver/wiki/API-Locatieserver#52url-parameters) | yes | | wt | Format | JSON | no | These options correspond with the options mentioned in the [Locatieserver documentation (Dutch)](https://github.com/PDOK/locatieserver/wiki/API-Locatieserver#52url-parameters), which describes them in more detail. Example using extra options: ``` php // On the geocoder instance: $client = new \GuzzleHttp\Client(); $options = ['fq' => 'bron:BAG']; $geocoder = new \Swis\Geocoder\NationaalGeoregister\NationaalGeoregister($client, $options); // Or just once on the query: $query = \Geocoder\Query\GeocodeQuery::create(...)->withData('fq', 'bron:BAG');

Response

The geocoder returns a \Geocoder\Model\AddressCollection which is a collection of \Geocoder\Model\Address., (*8)

Example response (first \Geocoder\Model\Address from collection) for query "3e Binnenvestgracht 23T1, Leiden" using this provider:, (*9)

``` php $address->getCoordinates() => \Geocoder\Model\Coordinates $address->getLatitude() => 52.164203 $address->getLongitude() => 4.49202289 $address->getBounds() => null (unavailable) $address->getStreetNumber() => '23T-1' $address->getStreetName() => '3e Binnenvestgracht' $address->getPostalCode() => '2312NR' $address->getLocality() => 'Leiden' $address->getSubLocality() => null (unavailable) $address->getAdminLevels()->get(2)->getName() => 'Leiden' $address->getAdminLevels()->get(2)->getCode() => '0546' $address->getAdminLevels()->get(1)->getName() => 'Zuid-Holland' $address->getAdminLevels()->get(1)->getCode() => 'PV28' $address->getCountry() => 'Netherlands' (static) $address->getCountryCode() => 'NL' (static) $address->getTimezone() => 'Europe/Amsterdam' (static), (*10)


## Change log Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. ## Testing ``` bash $ composer test

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details., (*11)

Security

If you discover any security related issues, please email security@swis.nl instead of using the issue tracker., (*12)

Credits

License

The MIT License (MIT). Please see License File for more information., (*13)

This package is Treeware. If you use it in production, then we ask that you buy the world a tree to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats., (*14)

SWIS :heart: Open Source

SWIS is a web agency from Leiden, the Netherlands. We love working with open source software., (*15)

The Versions

27/02 2018

dev-master

9999999-dev https://github.com/swisnl/geocoder-php-nationaal-georegister-provider

Nationaal Georegister provider for Geocoder PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

geocoder provider swisnl swis nationaal-georegister ngr

27/02 2018

1.1.0

1.1.0.0 https://github.com/swisnl/geocoder-php-nationaal-georegister-provider

Nationaal Georegister provider for Geocoder PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

geocoder provider swisnl swis nationaal-georegister ngr

23/02 2018

dev-feature-locatieserver-v3

dev-feature-locatieserver-v3 https://github.com/swisnl/geocoder-php-nationaal-georegister-provider

Nationaal Georegister provider for Geocoder PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

geocoder provider swisnl swis nationaal-georegister ngr

07/02 2018