Google Maps Geocoder provider
This is the Google Maps Places provider from the PHP Geocoder. This is a READ ONLY repository. See the main repo for information and documentation.
composer require geocoder-php/google-maps-places-provider
This provider often requires extra data when making queries, due to requirements of the underlying places API.
This provider supports two different modes of geocoding by text.
This is the default mode. It required an exact places name. It's not very forgiving, and generally only returns a single result
This mode will perform a search based on the input text.
It's a lot more forgiving that the
find mode, but results will contain all fields and thus be billed at the highest rate.
$findResults = $provider->geocodeQuery(GeocodeQuery::create('Museum of Contemporary Art Australia')); // One Result $searchResults = $provider->geocodeQuery(GeocodeQuery::create('art museum sydney')) ->withData('mode', GoogleMapsPlaces::GEOCODE_MODE_SEARCH); // 20 Results
When reverse geocoding, you are required to supply either a
$results = $provider->reverseQuery(ReverseQuery::fromCoordinates(-33.892674, 151.200727)->withData('type', 'bar'));