此處新增了Leaflet用戶,並且我開發了一個從Oracle數據庫中提取geoJSON的映射應用程序。這一切都可以,但是如果我放大傳單的方式顯示該大陸的多個副本,我的數據只有在放大中心大陸時纔會顯示。我的問題是這是正常的?如何防止用戶在繼續向東或西方向移動時平移到另一個大陸?在最大放大小冊子時顯示的多個大洲 - 僅在中心大陸顯示的數據
1
A
回答
0
您可以設置一個minZoom
屬性來避免這種情況。
喜歡的東西:
var map = L.map('map', {
center: [51.505, -0.09],
minZoom: 4,
zoom: 13
});
編輯:也許我誤解你的問題。
要限制地圖視圖使用指定的界限:
map.setMaxBounds(LatLngBounds);
更具體地說:
map.setMaxBounds(L.latLngBounds(
L.latLng(85, -180),
L.latLng(-85, 180)
));
0
我懷疑這是正常的,我不相信Leaflet試圖在高變焦狀態下複製標記。
你可以嘗試啓用map.worldCopyJump
,這聽起來像它可能適用於你的目的:
啓用該選項後,當您移動到另一個世界的 「複製」和無縫地圖的軌道跳到原始的一個,所以 所有覆蓋像標記和矢量圖層仍然可見。
如果失敗,請嘗試限制minZoom
和/或設置maxBounds
,like in this example:
var southWest = L.latLng(40.712, -74.227),
northEast = L.latLng(40.774, -74.125),
bounds = L.latLngBounds(southWest, northEast);
var map = L.map('map', {
// set that bounding box as maxBounds to restrict moving the map
// see full maxBounds documentation:
// http://leafletjs.com/reference.html#map-maxbounds
maxBounds: bounds,
maxZoom: 19,
minZoom: 10
});
// zoom the map to that bounding box
map.fitBounds(bounds);
相關問題
- 1. 在數據表中顯示最大大小時的消息
- 2. 顯示大陸地圖和放大顯示國家
- 3. 在where子句中顯示最小值,最大值=值太多?
- 4. 字數,表單大小,在html中顯示的東西大小
- 5. 顯示放大的SVG在設計大小
- 6. Jquery可調整大小顯示大小,同時調整大小
- 7. Div僅在放大或縮小時正確顯示
- 8. 如何在較小格子的中心顯示大圖像
- 9. PHP最大的多個值顯示
- 10. Redis:顯示密鑰的數據庫大小/大小
- 11. 顯示最大字段數
- 12. AppleScript,多顯示器和最大窗口大小
- 13. 在CListCtrl中顯示文件的大小
- 14. 顯示圖片的大小
- 15. 在Chrome中顯示時字體大小較大
- 16. 在通知中心顯示大圖標
- 17. 大規模放大後TextView不顯示
- 18. 顯示最小和最大輸入
- 19. Oracle SQL查詢 - 僅顯示最大值?
- 20. Google地理位置不顯示大洲
- 21. 如何突出顯示大洲
- 22. 調整UITableViewCell的大小以顯示最大尺寸的圖像
- 23. 根據顯示區域的大小來計算字體大小
- 24. 僅顯示Y軸上的最小值/最大值(使用C3JS)
- 25. 在asp.net網格中顯示大數據
- 26. 在圖表中顯示大量數據
- 27. 只顯示組中的最大計數
- 28. 顯示數組中最大的單詞
- 29. 多動態大小的UILabels不顯示
- 30. SQL選擇最大,然後顯示值小於最大