Pregunta

I am working on a mobile web site for a MS Bike event. I already have geo code for tagging email requests, and a check-in site to check riders in to a location based on their location. I would like to add the distance to the next rest stop / finish. I know how to figure out the distance between two locations. And all my research on this, it to allow Google to provide the route. But since this is an event, there is a predetermined route that the riders ride.

Does anyone have any ideas on how to tackle this? I have the Lat/Long of the routes (each corner and turn) and I have it in a kml format.

¿Fue útil?

Solución

If the resolution of the way-points is distinct enough I can see two cases: The nearest way-point is either the next point or was the previous point:

enter image description here

So if you not only calculate the distance to the nearest point but also to the previous and next to it, you should be able to simply decide which one the next is.

As written, this requires that the resolution between the points is good enough. E.g. if you have a course with a 180 degree curve things don't evaluate that well any longer:

enter image description here

The solution is to have enough way-points in these areas then. So this might or might not be suitable for your problem. Sorry for the trashy graphics, but I hope they illustrate this well enough. Also the concept is a bit rough, but probably good enough to create a first mock.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top