Center map and zoom to fit the markers on the screen

后端 未结 1 1945
[愿得一人]
[愿得一人] 2020-12-07 05:33

I have the following code to detect the visitors GPS position and show it on the Google Maps JavaScript v3 map. Everything works as I want it but the code will not center or

相关标签:
1条回答
  • 2020-12-07 06:04

    The general solution to fitting the map display to a set of markers is to add them to an empty google.maps.LatLngBounds object (by calling bounds.extend), then calling map.fitBounds with that bounds.

    0 讨论(0)
提交回复
热议问题