A geocoder address request allows you to geocode a coordinate from an address.
First of all, let's build a geocoder address request:
use Ivory\GoogleMap\Service\Geocoder\Request\GeocoderAddressRequest;
$request = new GeocoderAddressRequest('1600 Amphitheatre Parkway, Mountain View, CA');The geocoder address request constructor requires an address as first argument.
If you want to update the address, you can use:
$request->setAddress('1600 Amphitheatre Parkway, Mountain View, CA');Be aware, the address also allows IP address.
If you want to provide component filtering, you can use:
use Ivory\GoogleMap\Service\Geocoder\Request\GeocoderComponentType;
$request->setComponents([
GeocoderComponentType::POSTAL_CODE => 59800,
GeocoderComponentType::COUNTRY => 'fr',
]);If you want to restrict the geocoder area, you can use a bound:
$request->setBound(new Bound(
new Coordinate(-1.1, -2.1),
new Coordinate(2.1, 1.1)
));If you want to update the region, you can use:
$request->setRegion('en');If you want to update the language, you can use:
$request->setLanguage('fr');