Geocoder Base Addresse Nationale France adapter

dev-master / 1.0.x-dev 2018-12-11 23:00 UTC

This package is auto-updated.

Last update: 2024-02-12 10:03:58 UTC


Build Status Quality Score Latest Stable Version Software License

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:


composer require sheub/ban-france-provider


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));


Contributions are very welcome! Send a pull request to the main repository or report any issues you find on the issue tracker.