簡體   English   中英

傳單:圖像疊加和縮放級別

[英]Leaflet: Image Overlay and zoom levels

我在我的地圖中添加了一個圖像(圖像疊加)。 我可以根據圖像“調整”縮放級別嗎?

在縮放級別 17 時,柵格地圖的分辨率與屏幕分辨率相比太低。 在縮放級別 16 時,柵格地圖不再可讀。

是否可以定義類似“zoomlevel 17: 1px of the image = 1px of the screen”之類的東西?

請原諒我笨拙的英語。 非常感謝!

 var map = L.map('image-map', { minZoom: 16, maxZoom: 18, }).setView([46.975768, 7.436308], 17); var imageUrl = '../Bilder/Karten/Normalansicht.png', imageBounds = [[46.966635, 7.415942], [46.998849, 7.470108]]; L.imageOverlay(imageUrl, imageBounds).addTo(map); map.setMaxBounds(imageBounds);

是否可以定義類似“zoomlevel 17: 1px of the image = 1px of the screen”之類的東西?

不。

但是,您可以做的是使用CRS.Simple 在此坐標系中,縮放級別為 0 時,1 個地圖單位 = 1px。您必須調整圖像疊加坐標以達到所需的屏幕分辨率/圖像分辨率比。

http://leafletjs.com/examples/crs-simple/crs-simple.html查看有關 CRS.Simple 的教程

另一種選擇是使用分數縮放控件(僅在 Leaflet 1.0.0-beta 中可用,在 0.7.x 系列中不可用)。 通過設置zoomSnapzoomDelta選項,用戶將能夠設置縮放級別,例如zoomDelta和 16.75。

沒有這方面的教程,但您可以在https://github.com/Leaflet/Leaflet/blob/master/debug/map/zoom-delta.html檢查一些測試代碼

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM