Streamlit for visuallisation of large GeoTiff files

Hi all,

I would need to visualise large geospatial datasets in GeoTiff format. Does streamlit work well with that? Does anyone have an example or tutorial that I could look at?

Many thanks

These can be displayed as a jpg, or do you need to keep the high resolution/file format?

Unfortunately jpg won’t do for me. I need to retain the high resolution file and format.

Sounds quite specialised. I would suggest also searching for examples where people have worked with medical imagery, which has similar specialised requirements

1 Like

Per StackOverflow, it sounds like TIFF files are not well supported in browsers:

I tried this in Chrome (5MB tif, guess it depends on what is “large”) and it didn’t render:

import streamlit as st

st.markdown("![Alt Text](https://download.osgeo.org/geotiff/samples/usgs/o41078a5.tif)")

I don’t have a Mac to test on for Safari, but if it’s going to work, I think this is how you would do it.

Best,
Randy

Hi Randy, thanks for the link. Yes, it seems there are some issues rendering the .tiff files.

1 Like

You can use Pillow to load the tiff, then display it directly or convert to png. If the issue is that the file is very large, you could convert it to a cloud optimised geotiff (COG) as these support range requests. You could then display one of the downsampled tiles

1 Like