geocoder-php / Geocoder

The most featured Geocoder library written in PHP.
https://geocoder-php.org
MIT License
3.94k stars 516 forks source link

API access denied. #1028

Closed klikpaspor closed 4 years ago

klikpaspor commented 4 years ago

Message: You must use an API key to authenticate each request to Google Maps Platform APIs. For additional information, please refer to http://g.co/dev/maps-no-account

use Geocoder\Query\GeocodeQuery;
use Geocoder\Query\ReverseQuery;

$httpClient = new \Http\Adapter\Guzzle6\Client();
$provider = new \Geocoder\Provider\GoogleMaps\GoogleMaps($httpClient);
$geocoder = new \Geocoder\StatefulGeocoder($provider, 'en');

$result = $geocoder->geocodeQuery(GeocodeQuery::create('Buckingham Palace, London'));
$result = $geocoder->reverseQuery(ReverseQuery::fromCoordinates(...));

API access denied.

atymic commented 4 years ago

As per the link in the error, you need to use an API key.

https://github.com/geocoder-php/Geocoder/blob/master/src/Provider/GoogleMaps/GoogleMaps.php#L82-L89

We should probably clarify this is the docs, though.

klikpaspor commented 4 years ago

version 3.x no need an Api key right? or Google has updated?

jbelien commented 4 years ago

AFAIK it needs an API Key ; Google do not provide any API without an API key !

See link provided in error message: http://g.co/dev/maps-no-account

atymic commented 4 years ago

Sorry about the accidental close. PR to update the docs here: https://github.com/geocoder-php/Geocoder/pull/1030