问题
If I want to open a browser to Google Maps to center and show a single marker, I do it with a URL like this:
https://www.google.com/maps/place//@33.91729,-106.85761,10z/data=!4m2!3m1!1s0x0:0x0
But, I have 5-10 lat/long pairs that I want to show on that same map. How can I show multiple lat/long markers all specified only in a URL?
回答1:
There is an up-to-date article (updated: May 18 2017) about easily linking to locations and directions using the New Google Maps.
You could use the directions service and form a url as such:
https://www.google.com/maps/dir/33.93729,-106.85761/33.91629,-106.866761/33.98729,-106.85861
Use double slash "//" between markers to leave a position empty e.g. to set a custom start point.
Update
There is another excellent article here
回答2:
Well, it is possible without directions. just add at the end: //@ . example:
https://www.google.com/maps/dir/33.93729,-106.85761/33.91629,-106.866761/33.98729,-106.85861//@34.0593359,-106.7131944,11z
回答3:
You might want to take a look at this thread here. However, if you want to make it dynamic, why not use js to have these added as collection and load it to your page?
来源:https://stackoverflow.com/questions/35400664/google-maps-multiple-markers-via-url-only