Stay organized with collections Save and categorize content based on your preferences.
The Roads API takes up to 100 independent coordinates, and returns the closest road segment for each point. The points passed don't need to be part of a continuous path.
If you are working with sequential GPS points, use Snap to Roads.
RequestsA request to nearest roads must be sent using HTTPS, and takes the following form:
https://roads.googleapis.com/v1/nearestRoads?parameters&key=YOUR_API_KEYRequired parameters
The points to be snapped. The points parameter accepts a list of latitude/longitude pairs. Separate latitude and longitude values with commas. Separate coordinates with the pipe character: "|". For example: points=60.170880,24.942795|60.170879,24.942796|60.170877,24.942796
.
The following request returns a set of road segments based on the specified list of coordinates.
URLhttps://roads.googleapis.com/v1/nearestRoads ?points=60.170880%2C24.942795%7C60.170879%2C24.942796%7C60.170877%2C24.942796 &key=YOUR_API_KEYcURL
curl -L -X GET 'https://roads.googleapis.com/v1/nearestRoads?points=60.170880%2C24.942795%7C60.170879%2C24.942796%7C60.170877%2C24.942796&key=YOUR_API_KEY'Responses
For each valid request, the Roads API will return a response in the format indicated within the request URL.
{ "snappedPoints": [ { "location": { "latitude": 60.170878428876755, "longitude": 24.94269540970182 }, "originalIndex": 0, "placeId": "ChIJfVFHrM0LkkYRBzUQos_jR5w", }, { "location": { "latitude": 60.17087741412199, "longitude": 24.942695474405202 }, "originalIndex": 1, "placeId": "ChIJfVFHrM0LkkYRBzUQos_jR5w", }, { "location": { "latitude": 60.170875416131736, "longitude": 24.942695601802203 }, "originalIndex": 2, "placeId": "ChIJfVFHrM0LkkYRBzUQos_jR5w", }, ], }
The response uses the following schema.
NearestRoadsResponse Field Required Type DescriptionsnappedPoints
optional Array<SnappedPoint>
An array of snapped points. Sometimes containing several snapped points for the same point with differing placeId or location.
See SnappedPoint for more information.
SnappedPoint Field Required Type Descriptionlocation
required LatitudeLongitudeLiteral See LatitudeLongitudeLiteral for more information. placeId
required string
A unique identifier for a place. All place IDs returned by the Roads API correspond to road segments.
originalIndex
optional number
An integer that indicates the corresponding value in the original request. Each value in the request should map to a snapped value in the response. However, if you've set interpolate=true or if you're using nearest roads, then it's possible that the response will contain more coordinates than the request. Interpolated values will not have an originalIndex
. These values are indexed from 0
, so a point with an originalIndex of 4
will be the snapped value of the 5th latitude/longitude passed to the path parameter. Nearest Roads points may contain several points for single coordinates with differing location or placeId.
An object describing a specific location with Latitude and Longitude in decimal degrees.
Field Required Type Descriptionlatitude
required number
Latitude in decimal degrees
longitude
required number
Longitude in decimal degrees
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-14 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-14 UTC."],[[["The Roads API identifies the nearest road segment for up to 100 independent latitude/longitude coordinates."],["Requests are made via HTTPS using a specified URL structure including your API key and the desired coordinates."],["Responses provide a list of snapped points, each containing the location on the road, a unique place ID, and potentially the original request index."],["Each snapped point represents the closest road segment to the corresponding input coordinate, offering valuable road network data."],["Use Snap to Roads API when working with sequential GPS points, as this API focuses on individual, independent coordinates."]]],["The Roads API receives up to 100 independent latitude/longitude coordinate pairs and identifies the closest road segment for each. Submit requests via HTTPS, including the coordinates separated by commas and pipes (e.g., `60.170880,24.942795|60.170879,24.942796`). The API returns an array of `snappedPoints`, containing each point's `location` (latitude/longitude), `placeId` (road segment identifier), and `originalIndex` (position in the request). Sequential points should be processed using `Snap to Roads` instead.\n"]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4