-1

I have a google map directions list of lat/lon coordinates that form a path, of say 500km.

How can a calculate the point on the line that is the middle point by distance? (In this case 250km)

I can do it iterating all the points but there must be a better way, right?

1 Answers1

0

Google Maps API provides a Geometry library. It doesn't have a function to get the midpoint of a path but it has a computeLength function which returns the length of a path. So it may help reduce the code you will have to write to get the eventual midpoint.

https://developers.google.com/maps/documentation/javascript/reference#spherical

eNVy
  • 487
  • 3
  • 10