I've got a lot of single-band Geotiff files with the GDT_Float32 format and I need to present these over the web, hopefully using a webmap leaflet/mapbox/googlemaps widget where clients can hover over the map and explore the values.

I've been looking at gdal2tiles.py but it resamples everything down to 8-bit png. Converting to 8-bit isn't going to work for me since I need to retain the precision.

Is there a solution out there for creating 32-bit png tiles for a web viewer? Should I be thinking about this another way?

  • Just out of curiosity, what sort of information does Geotiff store in the 32 bits? Is this 32-bit color? – user1462 Apr 30 '16 at 18:06
  • It's a single band so that's functionally grayscale. Think a single 2D array filled with Float32. – Raychaser Apr 30 '16 at 19:10
  • 1
    OK, so you really have/need over 4 billion shades of gray? Most people can only distinguish like 50 (I've heard...) – user1462 Apr 30 '16 at 20:24
  • A fair point. I think visually 255 values would be enough but I don't want to lose the actual values of the raster which correspond to experimental results. Maybe I need to store that information separately? Not really sure how though – Raychaser Apr 30 '16 at 23:46
  • 2
    Yeah, you just need to have a set of "original" files at 32-bit colour channels, and a set of "web-ready" files at 8-bit colour. Keep them separate, and have a script to quickly produce the 8-bit ones from the 32-bit ones. – IvanSanchez May 1 '16 at 13:02

As per @IvanSanchez' suggestion I'm going g to have web-ready 8-bit rasters with accompanying json metadata files.

The metadata files have max and min values from the original 32-bit rasters which we use to interpolate the 0-255 values from the 8bit rasters so we can explore the values in real time.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.