Skip to content

Latest commit

 

History

History
44 lines (28 loc) · 1.44 KB

geocoder_request.md

File metadata and controls

44 lines (28 loc) · 1.44 KB

Geocoder Request

Depending on what you want to geocode, you need to choose the appropriate request. The library allows you to geocode from an address, a coordinate or a place id.

Address request

An address request allows you to geocode a coordinate from an address:

use Ivory\GoogleMap\Service\Geocoder\Request\GeocoderAddressRequest;

$request = new GeocoderAddressRequest('1600 Amphitheatre Parkway, Mountain View, CA');
$response = $geocoder->geocode($request);

If you want to learn more about it, you can read its documentation.

Coordinate request

A coordinate request allows you to geocode an address from an coordinate:

use Ivory\GoogleMap\Base\Coordinate;
use Ivory\GoogleMap\Service\Geocoder\Request\GeocoderCoordinateRequest;

$request = new GeocoderCoordinateRequest(new Coordinate(48.865475, 2.321118));
$response = $geocoder->geocode($request);

If you want to learn more about it, you can read its documentation.

Place id request

A geocoder place id request allows you to geocode an address from an place id:

use Ivory\GoogleMap\Service\Geocoder\Request\GeocoderPlaceIdRequest;

$request = new GeocoderPlaceIdRequest('place_id');
$response = $geocoder->geocode($request);

If you want to learn more about it, you can read its documentation.