snap To Roads

GET https://roads.googleapis.com/v1/snaptoroads?path=<string>|<string>

This service returns the best-fit road geometry for a given set of GPS coordinates. This service takes up to 100 GPS points collected along a route, and returns a similar set of data with the points snapped to the most likely roads the vehicle was traveling along. Optionally, you can request that the points be interpolated, resulting in a path that smoothly follows the geometry of the road.

Request Params

KeyDatatypeRequiredDescription
pathstring(Required) The path to be snapped. The path parameter accepts a list of latitude/longitude pairs. Latitude and longitude values should be separated by commas. Coordinates should be separated by the pipe character: "
<div class="note">Note: The snapping algorithm works best for points that are not too far apart. If you observe odd snapping behavior, try creating paths that have points closer together. To ensure the best snap-to-road quality, you should aim to provide paths on which consecutive pairs of points are within 300m of each other. This will also help in handling any isolated, long jumps between consecutive points caused by GPS signal loss, or noise.</div>
interpolatestringWhether to interpolate a path to include all points forming the full road-geometry. When true, additional interpolated points will also be returned, resulting in a path that smoothly follows the geometry of the road, even around corners and through tunnels. Interpolated paths will most likely contain more points than the original path. Defaults to false.

HEADERS

KeyDatatypeRequiredDescription
Acceptstring

RESPONSES

status: OK

{&quot;snappedPoints&quot;:[{&quot;location&quot;:{&quot;latitude&quot;:-35.27800489993019,&quot;longitude&quot;:149.129531998742},&quot;originalIndex&quot;:0,&quot;placeId&quot;:&quot;ChIJr_xl0GdNFmsRsUtUbW7qABM&quot;},{&quot;location&quot;:{&quot;latitude&quot;:-35.280323564795005,&quot;longitude&quot;:149.1290903128365},&quot;originalIndex&quot;:1,&quot;placeId&quot;:&quot;ChIJOyypT2hNFmsRZBtscGL0htw&quot;},{&quot;location&quot;:{&quot;latitude&quot;:-35.28101395754623,&quot;longitude&quot;:149.1292430025548},&quot;originalIndex&quot;:2,&quot;placeId&quot;:&quot;ChIJv5r0smlNFmsR5nunau79Fv4&quot;},{&quot;location&quot;:{&quot;latitude&quot;:-35.28146506991143,&quot;longitude&quot;:149.12978858234607},&quot;originalIndex&quot;:3,&quot;placeId&quot;:&quot;ChIJ601MoWlNFmsR5mvkfPp2ovA&quot;},{&quot;location&quot;:{&quot;latitude&quot;:-35.28194399606459,&quot;longitude&quot;:149.1299842294294},&quot;originalIndex&quot;:4,&quot;placeId&quot;:&quot;ChIJ601MoWlNFmsR5mvkfPp2ovA&quot;},{&quot;location&quot;:{&quot;latitude&quot;:-35.28282136229385,&quot;longitude&quot;:149.12956142620385},&quot;originalIndex&quot;:5,&quot;placeId&quot;:&quot;ChIJaUpThGlNFmsRMHWxoH7EOsc&quot;},{&quot;location&quot;:{&quot;latitude&quot;:-35.28313383700836,&quot;longitude&quot;:149.12893500604946},&quot;originalIndex&quot;:6,&quot;placeId&quot;:&quot;ChIJWSb8ImpNFmsRp_4JAxJFE1A&quot;},{&quot;location&quot;:{&quot;latitude&quot;:-35.284728747199374,&quot;longitude&quot;:149.12834860726772},&quot;originalIndex&quot;:7,&quot;placeId&quot;:&quot;ChIJtWxAZmpNFmsRlbUCkc6VtnA&quot;}]}