sheub / ban-france-provider
Geocoder Base Addresse Nationale France adapter
Installs: 2 659
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Open Issues: 2
Requires
- php: ^7.0
- geocoder-php/common-http: ^4.0
- willdurand/geocoder: ^4.0
Requires (Dev)
- geocoder-php/provider-integration-tests: ^1.1
- nyholm/psr7: ^0.2.2
- php-http/curl-client: ^1.7
- php-http/message: ^1.0
- phpunit/phpunit: 6.3.*
Provides
This package is auto-updated.
Last update: 2024-10-12 11:33:51 UTC
README
Geocoder PHP is a PHP library which helps you build geo-aware applications by providing a powerful abstraction layer for geocoding and reverse-geocoding. See the main repo for the documentation.
This is the provider for the Base Addresse Nationale Geocoder. Its coverage is limited to France. Additional information on the service and the API can be found here: https://adresse.data.gouv.fr/
Install
composer require sheub/ban-france-provider
Usage
use Geocoder\Query\GeocodeQuery; use Geocoder\Provider\BANFrance\BANFrance; use Geocoder\Model\Coordinates; use Geocoder\Query\GeocodeQuery; use Geocoder\Query\ReverseQuery; use Http\Client\HttpClient; $httpClient = new \Http\Adapter\Guzzle6\Client(); $geocoder = new BANFrance($httpClient); // Query with unstructured address $result = $geocoder->geocodeQuery(GeocodeQuery::create('8 Boulevard du Port 80000 Amiens')); // Query with limit and postcode $query = GeocodeQuery::create('8 Boulevard du Port'); $query = $query->withLimit(1); $query = $query->withData('postcode', 80000); $result = $provider->geocodeQuery($query); // Reverse geocoding $provider = new BANFrance($httpClient); $results = $provider->reverseQuery(ReverseQuery::fromCoordinates(48.8632156, 2.3887722));
Contribute
Contributions are very welcome! Send a pull request to the main repository or report any issues you find on the issue tracker.