Answered by:
Identifying waypoints on a route
Question

I'm using the following example to generate a route:
https://msdn.microsoft.com/enus/library/ff701717.aspx?f=255&MSPPError=2147217396
Is it possible, give a specific latitude, longitude to identify whether that point is on the generated route? Ideally, with a specified margin of error (for example, within 1/2 mile of the route)?
Answers

The route service won't tell you if some arbitrary coordinate is on the route path. This is something that can be calculated afterwards.
If using .NET the SQL Spatial tools (available as a .NET library and doesn't actually require SQL) to calculate this.
If using JavaScript, the Bing Maps V8 control has a spatial math module which provides similar functions.
Using either of these you can do the following:
 Take the route path information from the REST service response and create a LineString (SQL) or Polyline (V8) object.
 Use the spatial math function to calculate distance.
I've put together a code sample that you can try here: http://bingmapsv8samples.azurewebsites.net/#Calculate%20Distance%20From%20Route
The source code is here: https://github.com/Microsoft/BingMapsV8CodeSamples/blob/master/Samples/Spatial%20Math/Geometry/Calculate%20Distance%20From%20Route.html
 Proposed as answer by Ricky_Brundritt Friday, March 24, 2017 8:15 PM
 Marked as answer by pcmichaels Saturday, March 25, 2017 10:33 AM
All replies

The route service won't tell you if some arbitrary coordinate is on the route path. This is something that can be calculated afterwards.
If using .NET the SQL Spatial tools (available as a .NET library and doesn't actually require SQL) to calculate this.
If using JavaScript, the Bing Maps V8 control has a spatial math module which provides similar functions.
Using either of these you can do the following:
 Take the route path information from the REST service response and create a LineString (SQL) or Polyline (V8) object.
 Use the spatial math function to calculate distance.
I've put together a code sample that you can try here: http://bingmapsv8samples.azurewebsites.net/#Calculate%20Distance%20From%20Route
The source code is here: https://github.com/Microsoft/BingMapsV8CodeSamples/blob/master/Samples/Spatial%20Math/Geometry/Calculate%20Distance%20From%20Route.html
 Proposed as answer by Ricky_Brundritt Friday, March 24, 2017 8:15 PM
 Marked as answer by pcmichaels Saturday, March 25, 2017 10:33 AM
