Snap to Road API issue

Balasaheb Molawade 136 Reputation points
2024-07-03T14:25:19.79+00:00

Hi,

We are using the Snap to Road API of Bing Maps, and it works for some locations (latitude/longitude). However, for other locations (latitude/longitude), it throws the following error:

2

API: API: https://www.microsoft.com/en-us/maps/bing-maps/snap-to-road

Does anyone have any ideas on how to resolve this issue?

Thanks!

Azure Maps
Azure Maps
An Azure service that provides geospatial APIs to add maps, spatial analytics, and mobility solutions to apps.
651 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. rbrundritt 16,456 Reputation points Microsoft Employee
    2024-07-03T14:48:15.55+00:00

    The error is telling you the issue is that it doesn't support points that further than 2.5km apart when snapping. If your points are that spread out, use the routing service.

    You could loop through your points in sequential order and calculate the straight-line distance between points, if the distance is greater than 2.5km, either calculate a route for that single segment or for the whole set of points (depending on how many points you have).