Requests

Parameter Usage

Required Parameters

points — A list of latitude/longitude pairs. Latitude and longitude
values should be separated by commas. Coordinates should be separated by the
pipe character: "|". For example: points=60.170880,24.942795|60.170879,24.942796|60.170877,24.942796.

key — Your application's API key. Your
application must identify itself every time it sends a request to the
Roads API by including an API key with each request.
Learn how to get a key.

Responses

For each valid request, the Roads API will return a response in the
format indicated within the request URL. The following elements may be present
in a Snap to Roads response.

snappedPoints — An array of snapped points. Each point consists of
the following fields:

location — Contains a latitude and longitude value.

originalIndex — An integer that indicates the corresponding value
in the original request. Each point in the request maps to at most two
segments in the response:

If there are no nearby roads, no segment is returned.

If the nearest road is one-way, one segment is returned.

If the nearest road is bidirectional, two segments are returned.

placeId — A unique identifier for a place. All place IDs returned
by the Roads API correspond to road segments.
Place IDs can be used with other Google APIs, including the
Places API and the
Maps JavaScript API. For example, if you need
to get road names for the snapped points returned by the
Roads API, you can pass the placeId to the
Places API or the
Geocoding API. Within the
Roads API, you can pass the placeId in a
speed limits request to determine the speed limit along that road segment.

Example Request

The following request returns a set of road segments based on the specified
list of coordinates.