1

Im working on an app that shows different POIs in between location and destination on a route.

Together with a map, there is a list view representation of the route, with Location showing first (New York for example), Destination in the end (Let's say Boston) and POIs in between.

But if I add another location in between , lets say Chicago, and then continue adding those POIs, is there any way to know if an added POI is on a route between New York and Chicago, or it is between Chicago and Boston?

So is there a way of telling if a coordinate is between two other coordinates, but not in the general space, but on that route exactly?

Or, is there a way of knowing how far is the POI from the starting point of the route?

SteBra
  • 4,188
  • 6
  • 37
  • 68

1 Answers1

0

The SDK does not offer any helper functions for calculating this, but since you have access to the geometry of the route (via the get routeCoordinatesForRouteWithId method) you can calculate the distance from your point to the route.

There are a number of ways of doing this, described on multiple threads on Stackoverflow:

Note: you can also try to add the POI as a viaPoint to the existing route - if the route already passes that point then the result will be the same route (geometry wise) - if not then a new route geometry will be generated.

Community
  • 1
  • 1
Ando
  • 11,199
  • 2
  • 30
  • 46