GeoTIFF / georaster-layer-for-leaflet

Display GeoTIFFs and soon other types of raster on your Leaflet Map
https://geotiff.github.io/georaster-layer-for-leaflet-example/
Apache License 2.0
306 stars 58 forks source link

Question: loading minimal data from image with internal overviews #44

Open mortac8 opened 4 years ago

mortac8 commented 4 years ago

My goal is to load the minimal amount of data from a COG with internal overviews. Is this possible or do I need to be using external overviews?

I want to either load the entire image (using the internal overviews ex: 500x500) or load the actual data when far zoomed in. Any breadcrumbs to help me with this or best practices advice would be appreciated. Thanks!

DanielJDufour commented 4 years ago

Hi, @mortac8 . Thank you for posting this issue. I'll create an example that demonstrates this along with some documentation. It may take a couple days. I'll update this issue when that is complete. Thanks!

DanielJDufour commented 4 years ago

Hi, @mortac8 . Sorry, I haven't found time to create an example, but for what it's worth, this library should automatically load the minimal amount of data (including from internal or external overviews). It uses georaster, which uses geotiff.js, which is the code actually doing the fetching of tiles. I'll try to write something up more formally later and add that to the documentation.

mortac8 commented 4 years ago

Thanks for the info. I am on the fence on using your library vs one of these. My goal is to work with a large GeoTIFF file (~3GB) that has 16-bits per channel (RGB) which will be 'enhanced' through our algorithms (calculations need to be done on the 16-bit bands) and finally displayed onscreen in the standard 8-bit space.

https://github.com/christian-werner/leaflet-geotiff https://github.com/danwild/leaflet-geotiff-2

mortac8 commented 4 years ago

https://jsfiddle.net/mortac8/unjmv7o8/1/

Is that the general idea? Any way to fix issues where some of the tiles seem not to line up like on the roads?

DanielJDufour commented 4 years ago

Yup. The misalignment of the roads appears to be a by-product of both reprojecting and sampling the raster at the same time. There's a few possible solutions such as tweaking the resolution param and I can look at improving the core algorithm, but the easiest would be to reproject the raster into the resolution of the map. Assuming you are using Leaflet with the standard 3857 projection, could you reproject the enhanced 8-bit GeoTIFF into 3857?

I can also try to investigate this more thoroughly.