首页 > 解决方案 > 无法在 Leaflet-geotiff 上绘制 geotiff

问题描述

我正在尝试将我的 geotiff NDVI 数据绘制到传单上作为热图;但我无法呈现数据。似乎什么都没有显示。我的 geotiff 在 EPSG:4326 - 这是 geotiff;我正在尝试两个-

https://brian-transcription-test.s3.amazonaws.com/RGB_masked.tif

我的代码是这样的-

  const map = L.map('devTestingDemo').setView([ 18.5286120,73.9715862], 30);
  L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
    maxZoom: 10,
    attribution:
      '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
  }).addTo(map);

  const windSpeed = LeafletGeotiff.leafletGeotiff(
    'https://brian-transcription-test.s3.amazonaws.com/NDVINew4.tiff',
    {
      band: 0,
      name: 'Wind speed',
      renderer: new LeafletGeotiff.LeafletGeotiff.Plotty({
        displayMin: 0,
        displayMax: 30,
        arrowSize: 20,
        clampLow: false,
        clampHigh: true,
        colorScale: 'rainbow'
      })
    }
  ).addTo(map);

  const windDirection = LeafletGeotiff.leafletGeotiff(
    'https://brian-transcription-test.s3.amazonaws.com/NDVINew4.tiff',
    {
      band: 0,
      name: 'Wind direction',
      renderer: new LeafletGeotiff.LeafletGeotiff.VectorArrows({
        arrowSize: 20,
        displayMin: 0,
        displayMax: 6,
      })
    }
  ).addTo(map);
}```

标签: angularleaflet

解决方案


I would try changing LeafletGeotiff to L. For example:

const windSpeed = L.leafletGeotiff(
    'https://brian-transcription-test.s3.amazonaws.com/NDVINew4.tiff',
    {
      band: 0,
      name: 'Wind speed',
      renderer: new LeafletGeotiff.LeafletGeotiff.Plotty({
        displayMin: 0,
        displayMax: 30,
        arrowSize: 20,
        clampLow: false,
        clampHigh: true,
       colorScale: 'rainbow'
    })
  }
).addTo(map);

I am unsure about this part "new LeafletGeotiff.LeafletGeotiff.Plotty" you will need to experiment.


推荐阅读