Open Michael-Reich opened 6 years ago
The google documentation says you need the DistanceMatrixService
object to do what you want, and I don't see any reference on the API to that object, so I guess you can't at this moment with this package.
There is another way with an HTTP request: https://developers.google.com/maps/documentation/distance-matrix/start you can pass the latlng as is explained here
The DistanceMatrixService is for travel distance. But if you just want to know the distance between 2 points you can use a formula to work it out. Most common one is the Haversine formula for calculating the distance between 2 points on a sphere.
https://en.wikipedia.org/wiki/Haversine_formula
Here is a page that describes how to do it in javascript.
Is there any exmaple of how to calculate the distance from markers around the center to the center?
Do you have any code snippet or example, that would be super great!