使用文档示例,我试图放大到一个特定的点。所以我就这么做:
var latlng = L.latLng(50.5, 30.5);
$scope.map.setZoomAround(latlng);$scope.map是L.map()创建的有效映射对象。
我知道这个错误:
无效的LatLng对象:(NaN,NaN) o.LatLng (leaflet.js:6) at Object.unproject (leaflet.js:6) at Object.pointToLatLng (leaflet.js:6) at e.unproject (leaflet.js:6) at e.layerPointToLatLng (leaflet.js:6) at e.containerPointToLatLng (leaflet.js:6) at e.setZoomAround (leaflet.js:6)
执行$scope.map.setZoomAround([50.5, 30.5])引发相同的错误,$scope.map.setZoomAround(50.5, 30.5)抛出:
TypeError:无法读取null的属性“lat”
发布于 2016-11-07 12:37:09
重复检查 method,因为它期望指定缩放级别.
https://stackoverflow.com/questions/40463589
复制相似问题