Answer the question
In order to leave comments, you need to log in
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;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question