Google Maps fitBounds() 是否重新生成地图?

Does Google Maps fitBounds() regenerate the map?

我总是使用 panTo instead of setCenter 来重新居中 Google 地图,因为我在某处读到使用 panTo 不被视为地图的新日常使用(考虑在我的网站上使用 google 地图的每日限制)但我不记得我在哪里读到的。

现在我正在使用fitBounds,我不确定这种方法是否也能重新生成新地图?

如何找出哪些方法(例如 setZoomfitBounds)生成新地图? fitBounds吗?

您的理解是正确的。 fitBounds() 方法不会创建新地图,它只是将视口设置为包含给定的地图边界。

Google's documentation 声明如下:

SKU: Dynamic Maps

A web page or application that displays a map using the Maps JavaScript API. A map is created with the google.maps.Map() class.

User interactions with the map, such as panning, zooming, or switching map layers, do not generate additional map loads.

您也可以参考 this FAQ 了解地图加载的计算方式。

希望这能解决您的问题。