map.setCenter的参数是什么?

What are the parameters of map.setCenter?

我无法可靠地找到将第二个数字作为参数传递给该函数的单个文档。我有一个代码(来自一本书),上面写着:

map.setCenter(loc, 20);

其中 loc 是一个 google.maps.LatLng 对象。但是,输入函数的数字 (20) 是多少?它有什么作用?

这是(可能是因为您没有提供上下文)来自已弃用和关闭的 Google Maps JavaScript API v2.

它允许在一次操作中设置中心和缩放。

来自the documentation (on archive.org, since it was turned off May 2013 and the official documentation has been removed)

setCenter(center:GLatLng, zoom?:Number, type?:GMapType) | None

Sets the map view to the given center. Optionally, also sets zoom level and map type. The map type must be known to the map. See the constructor, and the method addMapType(). This method must be called first after construction to set the initial state of the map. It is an error to call operations on a newly constructed GMap2 object until after this function is invoked.

(注意: v2 有一个包装器,它允许某些 v2 功能继续工作,但如果它中断,不要指望它会被修复。 ..)