Search code examples
leafletgeotiff

What is the best way to show large GeoTiffs on a leaflet map?


For visualizing some geodata, we set up a small webserver running leaflet. All works fine, markers and polygons are shown as expected. Now we also want to show large raster files (stored as GeoTiff) as RGB on our map. We have full control over the tif files, we host them ourselves and we can store/process them in any way we want. Still, as they can get rather big in size (up to 30.000x20.000 pixels, three bands) , we are wondering what the best way to do that is.

Options we researched:

  1. Just display them using this plugin, will probably fail because of the size
  2. Store them as Cloud Optimized GeoTIFF: Its not clear to me if leaflet supports this
  3. Use this modified version of gdal2tiles.py
  4. Set up a "regular" tile server (didn't figure out how to do that yet)

As for now, we are only interested in visualization, although it would be a nice bonus if we could extract pixel values a specific location. How is this done nowadays?

edit: if that is important, the images only cover small areas and we only want to show one at a time, so we are not building a map or something, we want to draw them on top of a basemap


Solution

  • I found a perfect solution for my case: Terracotta, an open source lightweight Tile Server! Images do not need to be stored in tiled PNGs, but Terracotta servers tiles by reading from cloud-optimized geotiffs. Works like a charm!