【发布时间】:2019-04-10 10:16:38
【问题描述】:
我遇到了无法在地图上显示任何.tif 图像的问题。我正在为我的地图使用leaflet-geotiff 插件。我下载了文件(例如来自gis-lab.info,这里是link to download)并尝试粘贴并显示在我的地图上。但我总是得到Custom Mask is off screen.
这是我如何使用它的示例:
import * as geotiff from 'leaflet-geotiff/leaflet-geotiff';
import * as plotty from 'leaflet-geotiff/leaflet-geotiff-plotty';
export class MapComponent {
ngOnInit() {
this.map.on('load', () => {
const options = {
band: 0,
name: 'Custom Mask',
opacity: 1,
renderer: new plotty.Plotty({
colorScale: 'greys'
})
};
new geotiff.LeafletGeotiff('assets/uploads/clearcuts_174016_20101018_clip.tif', options).addTo(this.leafletMap);
});
}
}
还有我在浏览器控制台中的内容(我在 leaflet-geotiff lib 中添加了一些 console.log 以确保 tif 文件在那里解析):
似乎在leaflet-geotiff 的代码中,当plotHeight 和plotWidth 具有负值时会发生这种情况。而且我的图层仍然没有显示在地图上。我究竟做错了什么?以及如何正确显示自定义 tif 文件?
【问题讨论】:
标签: angular typescript leaflet geotiff