openlayers icon indicating copy to clipboard operation
openlayers copied to clipboard

OpenLayers unable to render Float32 GeoTiff

Open null4bl3 opened this issue 2 years ago • 4 comments

Describe the bug In this troubleshooting scenario we have 2 files.

  • One that works ( 'example.tif' ), downloaded from the OpenLayers documentation examples.

  • And then we have our file ( 'A60.tif' ), that doesn't work.

When trying to add the GeoTiff by URL in OpenLayers 9.0.0, using the COG examples in the OpenLayers documentation as a base, the layer is added but rendering is broken.

The 'A60.tif' GeoTiff file opens and renders in QGIS and the Leaflet tool ( http://app.geotiff.io/ ) just fine. But when trying to add it as a source GeoTIFF as a TileLayer to OpenLayers in the same way as the method used in the OpenLayers documentation. It does not render as if it is being loaded incorrectly,

To Reproduce Steps to reproduce the behavior:

  1. Go to https://codesandbox.io/p/devbox/geotiff-labs-yrsjk3?file=%2Fsrc%2Findex.html
  2. Below the map, i have added the NDVI data return values from 'pointermove'. It is always [ 0. 0 ] on the A60.tif file that is unable to render.

Expected behavior As the GeoTiff files are added in the exact same way, i was expecting them both to work.

Since one works, and the other does not, with the documentation mentioning anything about GeoTiff requirements, i was hoping someone here would take a look at it.

i have included the files in question to this issue. tifs.zip

null4bl3 avatar Jun 17 '24 11:06 null4bl3

It may be because it uses a ModelTransformation. I attempted to use the file with the full build from #15402 deploy preview but that is currently not available.

mike-000 avatar Jun 17 '24 15:06 mike-000

#15402 will fix this:

image

Note that the file is not handled correctly by http://app.geotiff.io/ as the image is misplaced and inverted:

image

Also you need to specify normalize: false, in your source settings to use float values in your style.

mike-000 avatar Jun 18 '24 11:06 mike-000

Thanks for the tip. For now we will flip our y-axis before saving the data to GeoTiff.

neda-dtu avatar Jun 18 '24 12:06 neda-dtu

Closing issue as #15402 will fix this.

Thanks for the response @mike-000

null4bl3 avatar Jun 18 '24 12:06 null4bl3