2016-11-18 34 views

回答

2

您可以使用map.fitBounds

var southWest = L.latLng(40.712, -74.227), 
northEast = L.latLng(40.774, -74.125), 
bounds = L.latLngBounds(southWest, northEast); 
map.fitBounds(bounds); 

http://leafletjs.com/reference-1.0.0.html#map-fitbounds

+0

感謝,但它的功能沒有做出正確的變焦.. –

+0

就是你能正確的變焦意思?縮放級別應與您的可見地圖的邊界相對應。 – user2441511