D
D
Dave2016-12-11 13:57:29
Google
Dave, 2016-12-11 13:57:29

Path distance rather than straight line distance via computeDistanceBetween(). How?

To calculate the distance between two points, the following code is used:

// Distance in meters
var distance = google.maps.geometry.spherical.computeDistanceBetween(
     new google.maps.LatLng(latitudeX, longitudeX), 
     new google.maps.LatLng(latitudeY, longitudeY)
);

var kilometers = distance * 0.001;

The distance is considered correct, but it is indicated in a straight line , and not along the track . Is it possible to calculate the distance along the track? Like for example here (see below)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2016-12-12
@freeExec

I watched it - https://developers.google.com/maps/documentation/d...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question