Description | : The Snap to Roads API accepts GPS point data, represented as longitude and latitude coordinates, and generates points that aligns with existing roadways on a map. This process, known as "snapping to roads", produces a series of objects that trace a path closely following the road network. The resulting data includes road names and their respective speed limits, pertinent to the traversed segments. Moreover, the Snap to Roads API offers an interpolation feature, which refines the GPS points to create a smoother route that adheres to the road's geometry. This functionality is especially beneficial for asset tracking and enhancing data visualization in mapping applications. >[!Important] > The GPS points must be within 6 kilometer of each other. For information about routing availability in countries/regions, see [Azure Maps routing coverage](https://learn.microsoft.com/azure/azure-maps/routing-coverage?pivots=latest). |
Reference | : Link ¶ |
⚶ Changes
{ "#id": "Route_PostSnapToRoads", "$parameters": { "snapToRoadsRequest": { "$properties": [ { "#name": "features", "Description": { "new": "A set of points to snap to road network. You can have a minimum of 2 points and maximum of 100 points and the two consecutive points must be within 6 kilometer of each other and a total road distance of up to 100 kilometers. Refer to [RFC 7946](https://www.rfc-editor.org/rfc/rfc7946) for details on the GeoJSON format.\n\n`Note`: The API will not return a point object in the response for the GPS point that cannot be snapped to a road network.", "old": "A set of points to snap to road network. You can have a minimum of 2 points and maximum of 100 points and the two consecutive points must be within 6 kilometer of each other. Refer to [RFC 7946](https://www.rfc-editor.org/rfc/rfc7946) for details on the GeoJSON format.\n\n`Note`: The API will not return a point object in the response for the GPS point that cannot be snapped to a road network." } } ] } } }
⚼ Request
POST:
/route/snapToRoads
{
api-version:
string
,
x-ms-client-id:
string
,
Accept-Language:
string
,
snapToRoadsRequest:
}
{
,
type:
enum
,
features:
[
]
,
{
,
type:
enum
,
geometry:
object
,
properties:
object
,
}
interpolate:
boolean
,
includeSpeedLimit:
boolean
,
travelMode:
enum
,
}
⚐ Response (200)
{
type:
enum
,
features:
}
[
,
object
,
]
⚐ Response (default)
{
$headers:
{
,
x-ms-error-code:
string
,
}
$schema:
}
{
,
error:
}
{
,
code:
string
,
message:
string
,
target:
string
,
details:
[
,
string
,
]
innererror:
}
{
,
code:
string
,
innererror:
string
,
}