我正在尝试使用图像叠加(小册子插件)在网络映射网站中查看带有8个波段的光栅图像(多波段卫星图像)。我得到的图像范围空白。这是我用过的光栅文件
<html>
<iframe src="https://onedrive.live.com/embed?cid=313D1A84155423E8&resid=313D1A84155423E8%21103&authkey=ADFZt66lh2yvK-g" width="98" height="120" frameborder="0" scrolling="no"></iframe>
</html>
中查看结果
这是源代码
<!DOCTYPE html>
<html>
<head>
<title>raster</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css"></script>
<style type="text/css">
html, body, #map {
margin: 0px;
height: 100%;
width: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script>
var map = L.map('map', {
center: [31,-8],
zoom: 8,
});
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', {
maxZoom: 18,
attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
'<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
'Imagery © <a href="http://mapbox.com">Mapbox</a>',
id: 'mapbox.streets'
}).addTo(map);
var bounds = new L.LatLngBounds(
new L.LatLng(34.22,-8.68),
new L.LatLng(32.01,-6.27));
var overlay = new L.ImageOverlay("croplf3.tif", bounds
);
map.addLayer(overlay);
</script>
</body>
</html>
答案 0 :(得分:0)
您应该可以使用内置的ImageOverlay功能。
var bounds = new L.LatLngBounds(
new L.LatLng(34.22, -8.68),
new L.LatLng(32.01, -6.27)
);
var overlay = new L.imageOverlay("croplf3.tif", bounds)
.addTo(map);
&#13;