I am trying to calculate the distance between two coordinates across the Atlantic Ocean using the Azure Maps routing service. Unfortunately I always get the following error:
{
"error": {
"code": "400 BadRequest",
"message": "Engine error while executing route request: NO_ROUTE_FOUND"
}
}
Does Azure Maps support the calculation or am I doing something wrong?
This is the example of the request which returns the error: https://atlas.microsoft.com/route/directions/json?api-version=1.0&subscription-key=XXXX-XXXX-XXXX-XXXX&query=29.757290,-95.357379:48.876584,2.339379
The coordinates are valid. 29.757290,-95.357379 is Houston (Texas, USA) 48.876584,2.339379 is Paris (France, Europe)
Can anybody help? Thanks.
The routing service calculates routes along roads, so it will fail to calculate a route that crosses the Atlantic Ocean. If you want to calculate the straight line (geodesic) path across between two points you have multiple options:
atlas.math.getDistanceTo
function: https://learn.microsoft.com/en-us/javascript/api/azure-maps-control/atlas.math?view=azure-maps-typescript-latest#azure-maps-control-atlas-math-getdistanceto