javascript - How to calculate distance between more than two points with google maps api? -


calculating distance between 2 point google maps easy , did. how calculate distance between more 2 marks in google map of google maps api?

this quite broad use-case, simple solution of question recommend using distance matrix api. find distances in between 2 or more cities. api request find distance in between 4 cities this.

https://maps.googleapis.com/maps/api/distancematrix/json?origins=vancouver+bc|seattle&destinations=san+francisco|victoria+bc&mode=bicycling&language=fr-fr&key=api_key 

this request return 4 elements - 2 origins times 2 destinations:

vancouver san francisco, vancouver victoria, seattle san francisco & seattle victoria

please take @ official google documentation of distance matrix api know more api requests more origins , destination.

one more option use direction api, cover points in path , there respective distance.

hope helps!!


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -