Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Cloud Optimized GeoTIFF #6332

Open
pjcozzi opened this issue Mar 14, 2018 · 24 comments
Open

Support for Cloud Optimized GeoTIFF #6332

pjcozzi opened this issue Mar 14, 2018 · 24 comments

Comments

@pjcozzi
Copy link
Contributor

pjcozzi commented Mar 14, 2018

https://trac.osgeo.org/gdal/wiki/CloudOptimizedGeoTIFF

Basically a GeoTIFF with tiles that can be served without a full tile server.

A good starting place could be this OpenLayers viewer by @cholmes: https://github.com/cholmes/cog-map

Could be a great code sprint project!

@cholmes
Copy link

cholmes commented Mar 14, 2018

Note that the openlayers viewer users an AWS lambda tile server. Though you're more than welcome to hit that tile server until I run out of credits. Could make a similar interaction easily.

The other thing to note is geotiffjs/geotiff.js#36 - this should hopefully be a pure JS library that cesium would be able to use. cc @constantinius

@mramato
Copy link
Contributor

mramato commented Mar 14, 2018

I was under the impression that cloud-optimized geotiffs were more for on-demand tiling using something like AWS lambda reading from a GeoTIFF stored on S3 (ideal for "serverless" but not something Cesium can do completely client side. Because of things like band data type, projection, compression, etc.. it would be really hard for Cesium to ingest the image as tiles without a server.

That being said, I would love to be wrong.

@cholmes
Copy link

cholmes commented Mar 14, 2018

Yeah, it's still an experiment that needs to be done, but if @constantinius is successful it should open the way for cesium. We've also contemplated a cloud optimized geotiff profile for a 'web cog', see locationtech/geotrellis#2284 - it'd be web mercator with tiles that match web tiles, and would have RGB, etc.

But yes, using COG's with on-demand tiling with geotiffs on S3 works today and would definitely be the place to start.

@mramato
Copy link
Contributor

mramato commented Mar 15, 2018

Sounds promising, thanks for the info.

@constantinius
Copy link

Hi folks!

I was under the impression that cloud-optimized geotiffs were more for on-demand tiling using something like AWS lambda reading from a GeoTIFF stored on S3 (ideal for "serverless" but not something Cesium can do completely client side. Because of things like band data type, projection, compression, etc.. it would be really hard for Cesium to ingest the image as tiles without a server.

GeoTIFF.js is capable of (or will soon be) handling all data abstraction stuff (remote reading, all kinds of tiling, compression, etc). It can read the actual raster values (TypedArrays) which can then be visualized. For single band false color visualization there is a good library that works well with the parsed data.

What we are currently thinking about is a JS library that creates nice RGB views of e.g Landsat images using various techniques like contrast stretching etc.

What is missing is handling the reprojection of the images to map them on the cesium globe. OpenLayers is capable of this, maybe it is possible to extract this piece and make it commonly available.

Those are the available/missing pieces, as we see it.

Thanks for connecting @cholmes

@mramato
Copy link
Contributor

mramato commented May 29, 2018

They recently launched http://www.cogeo.org/ which does a good job of summarizing everything. Also, every is just calling them COGs now.

Eugene from Azavea gave a good talk on it at FOSS4GNA as well, not sure when/if his slides will get posted: https://2018.foss4g-na.org/session/best-practice-serving-cog-imagery-using-mapserver-cloud-sponsored-aws

@lossyrob
Copy link

lossyrob commented Jul 6, 2018

Slides here: https://2018.foss4g-na.org/sites/default/files/slides/FOSS4G%20NA%202018%20-%20Cloud%20Optimized%20GeoTiffs.pdf

@pjcozzi
Copy link
Contributor Author

pjcozzi commented Aug 28, 2018

@philip-firstorder
Copy link

philip-firstorder commented Oct 8, 2019

I successfully implemented Google COGs on Google Maps with Geotiff.js and now I am implementing Cesium. I will be looking on this functionality and let you know of my progress.

@cr8tpro
Copy link

cr8tpro commented Feb 6, 2020

Hi @philip-firstorder. Is there any update with your implementation. I am using Cesium for my project and it's very helpful if I can render COGs on mapviewer.
Let me know if there is any updates.

@philip-firstorder
Copy link

Hello,

On fileorder.io you can create an account and upload COGs. Then just right-click the image and click View On Maps, you will then see your COG on Google Maps.

For Cesium I was delayed by some other developments and didn't get to implement COG on it yet.

@abhijitgujar86
Copy link

any update on the COG support ?

@hongfaqiu
Copy link
Contributor

hongfaqiu commented Feb 23, 2023

Hi @abhijitgujar86 , I just created a cesium plugin TIFFImageryProvider, which support Load and render Cloud optimized GeoTIFF on Cesium.

@jo-chemla
Copy link

I just created a cesium plugin TIFFImageryProvider,

Wonderful, thanks for sharing!
I just tried to load a custom landsat COG on your online demo (the one used on the OpenLayers example), but it could not load, do you know why? No error in the console, just an out-of-memory error in chrome and the tab crashes.

@hongfaqiu
Copy link
Contributor

@jo-chemla Hello, I have solved this problem, now you can add the OpenLayers example through my online demo

@jo-chemla
Copy link

jo-chemla commented Feb 23, 2023

Thanks, working great!
RGB channels seem to be inverted with other COGs like this one, but this should be easy to fix directly within the code.
By the way, nice layer tree component [edit] with the source here

@hongfaqiu
Copy link
Contributor

hongfaqiu commented Feb 23, 2023

@jo-chemla Thank you for your suggestion, as the readme says, you can customize the band of rgb channel. (Maybe I should provide more rendering configurations in the demo)
The layer tree was created with react-sortable-hoc, and you can copy the code from demo folder.

@hongfaqiu
Copy link
Contributor

@jo-chemla I added a multi-band/ single-band rendering configuration in the demo. You can try it.

@ilyaly
Copy link
Contributor

ilyaly commented Apr 19, 2023

@hongfaqiu , thanks for sharing, great job!

@jo-chemla , can you please describe how you've fixed the problem with inverted colors?

@hongfaqiu
Copy link
Contributor

@ilyaly, are you referring to the three-band rendering in TIFFImageryProvider? According to the API documentation, you can set the r, g, and b options to the corresponding color band index of the TIFF image. Here's an example code snippet for your reference:

const provider = new TIFFImageryProvider({
  url: 'YOURTIFF.tif',
  renderOptions: {
    r: { band: 4 },
    g: { band: 3 },
    b: { band: 2 },
  }
});

Hope this helps!

Great news! I have added WebGL support to the continuous color interpolation feature, which has significantly improved rendering speed. You are welcome to try it out and experience the difference!

@ilyaly
Copy link
Contributor

ilyaly commented Apr 20, 2023

@hongfaqiu , thank you for your reply!

Yeah I am talking about the three-band rendering. I do understand how to configure bands order but still cant reach a desired appearance.

For reference here is how this raster is displayed in COG Explorer:

image

And here is how it is displayed in your demo app:

image

@hongfaqiu
Copy link
Contributor

@ilyaly It seems like there is a bug, I suggest you to raise an issue in my repo, and I will fix it soon.

@constantinius
Copy link

@hongfaqiu This is probably due to a difference in the color representation. geotiff.js has a readRGB method, that translates to RGB colorspace.

@hongfaqiu
Copy link
Contributor

@constantinius Thank you for your help. I have just seen your message now. As you said, the problem has been resolved and it is now working properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests