stuartmatthews / leaflet-geotiff

Leaflet plugin for displaying geoTIFF raster data
MIT License
174 stars 76 forks source link

Large GeoTIFF file cacheable for next rendering #18

Open s9eenk opened 6 years ago

s9eenk commented 6 years ago

Hi Stuart, I m using a large geoTIFF file around like 500 MB , want to make it caheable for next rendering in order to make it easily accessible for second time without waiting(First time it loads for two minutes). Or else any suggestion for loading it quickly for the first time.

m-mohr commented 6 years ago

There is probably not much this library can do for you. GeoTiff is not supported by browsers and the data needs to be read from a file and painted to a canvas. That needs some time, especially for files that big as yours. There is no reliable way to cache this amount of data on client side. The only solution I could think of is to convert the GeoTIFF to PNG and display these file(s) using Leaflet. Browsers can cache and render them directly.

s9eenk commented 6 years ago

Thank you for your response Matthias. I have worked out your solution, for display purpose that is converting GeoTIFF to PNG. But, my concern is on the values inside the GeoTIFF file , where it's been shown on 'hover' of the map. I have only two options left to make it work i.e, placing the GeoTIFF file locally (here, it initially takes sometime to get the file locally on client and retrieve the values on hover )or else publish it on the server side and get the values from server side at every hit from client side, which hampers the performance. Any help in this regard is appreciable.

m-mohr commented 6 years ago

Well, this workaround probably only works for displaying the graphics, but not for your use-case where you interact with the data. With such big files you probably need to think about other solutions like the second approach you mentioned. It's never a good idea to transfer 500MB files to the user for processing so optimize it and maybe shift this to the server side. Sorry for not having a better solution for you.

m-mohr commented 6 years ago

@s9eenk In the long run, Cloud Optimized GeoTiff could be a solution for your problem: http://www.cogeo.org

chriszrc commented 6 years ago

Have you tried using cogs yet? Any pointers on how to get started using those?