【发布时间】:2022-12-20 23:56:15
【问题描述】:
传单文档提供了一个有见地的tutorial来处理非地理图像,但它基于imageOverlay。
const imageSize = {
width: 1000,
height: 1000,
}
const maxZoom = 10
const minZoom = 1
const toLatLng = (x, y) => L.CRS.Simple.pointToLatLng(new L.Point(x, y), maxZoom);
const bounds = [
toLatLng(0, 0),
toLatLng(imageSize.width, imageSize.height),
];
var viewer = L.map('viewer', {
crs: L.CRS.Simple,
maxBounds: bounds,
minZoom,
maxZoom,
zoomSnap: 0,
}).fitBounds(bounds);
L.imageOverlay('https://leafletjs.com/examples/crs-simple/uqm_map_full.png', bounds).addTo(viewer);
#viewer {
width: 100vw;
height: 100vh;
background: none;
}
<link href="https://unpkg.com/leaflet@1.9.3/dist/leaflet.css" rel="stylesheet"/>
<script src="https://unpkg.com/leaflet@1.9.3/dist/leaflet.js"></script>
<div id="viewer"/>
例如,我们如何将此示例与 tileLayer 转置以显示基于 Deep Zoom Image 的平铺图像。
【问题讨论】:
标签: javascript leaflet tiled deepzoom large-image