hongfaqiu / TIFFImageryProvider

Load GeoTIFF/COG(Cloud optimized GeoTIFF) on Cesium
https://tiff-imagery-provider.opendde.com/?panel=layer
MIT License
69 stars 13 forks source link

combining multiple TIFF's into a single TIFFImageryProvider #25

Open mhaberler opened 10 months ago

mhaberler commented 10 months ago

I have a set of 57 RGB TIF's which cover all of Austria, each about 10GB

Do you see a way to combine those into a single TIFFImageryProvider, similar to a GDAL VRT?

or do I need to add each one separately and select the right one?

thanks in advance,

Michael

ps: works great for me - congratulations!

hongfaqiu commented 10 months ago

Hello, thank you for your support and encouragement. This library currently only supports rendering a single TIFF file. Each TIFF file corresponds to a TIFFImageryProvider. If you have multiple TIFF files, you should group them together as a dataset. When you need to load a specific file, you can create a TIFFImageryProvider and display it on the Cesium globe.

The dataset can be formatted as a simple array, similar to the following format, which can be easily implemented in a frontend project:

type Layer = {
  id: string;
  name: string;
  url: string;
};

type DataSet = {
  id: string;
  name: string;
  layers: Layer[];
}

Nevertheless, loading 57 COG TIFF files of 10GB each onto Cesium puts a significant strain on performance. If you could test and implement this loading scenario in a similar js library like OpenLayers, please let me know, and I will try to address this performance issue.

mhaberler commented 10 months ago

@hongfaqiu thanks for the quick reply!

I'll explore your suggestion

I'll also give gdal_merge a try - probably pushing the envelope at 500GB ;)

appreciated - thanks! Michael

hongfaqiu commented 10 months ago

500GB! That's a tremendous amount, and if GDAL slices are too large, it poses a significant performance challenge for the frontend.

Wishing you good luck!

mhaberler commented 10 months ago

what do you think about a tiled approach like so:

stupid idea or doable?

edit: it seems this project uses titiler-generated tiles - in this case PNG's but not far off

the titiler documentation says it can generate GTIFF's

hongfaqiu commented 10 months ago

@mhaberler In fact, I have a classmate whose thesis is about researching how to manage multiple TIFF files and dynamically split them into tiles in real-time.

I presented these ideas to him about half a year ago, but I am unsure if he has continued researching them. 😂

Here is a demonstration from the official COG team: https://medium.com/devseed/cog-talk-part-2-mosaics-bbbf474e66df.

Edit: I just spoke with the classmate who is working on this research, and he has made significant progress. If you are interested, you can contact him directly at his email address: 272903058@qq.com.

hongfaqiu commented 10 months ago

what do you think about a tiled approach like so:

  • create a GDAL VRT of the GeoTIFF's
  • run titiler on the VRT
  • massage TIFFImageryProvider to deal with tiled GeoTIFF's

stupid idea or doable?

edit: it seems this project uses titiler-generated tiles - in this case PNG's but not far off

the titiler documentation says it can generate GTIFF's

I believe your idea is entirely feasible. It only requires a simple modification by transforming the TIFFImageryProvider into a class similar to UrlTemplateImageryProvider.

This modified class can load and render pre-split TIFF tiles using a URL template format like /cog/tiles/{z}/{x}/{y}.tiff.

However, it would be necessary to provide the band information and spatial extent of the TIFF in advance.