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

feature: Add Cloud Optimized GeoTIFF (COG) sample #2250

Merged
merged 4 commits into from
Jan 23, 2024

Conversation

ketourneau
Copy link
Contributor

@ketourneau ketourneau commented Dec 28, 2023

Description

We need to display Cloud Optimized GeoTIFF (COG) with iTowns.
A pull request already exist about COG but it seems to be abandoned.
We tried to used PR but we got some trouble with UTIF library to parse COG.
We think geotiff is a better library to parse COG.

Motivation and Context

We need to display heavy georeferenced tif file (geotiff) which come from CAD software.
We think the best solution is to convert geotiff to COG and display it with iTowns.
Maybe it can help this discussion ?

We will change the sample url if this PR on itowns data is accepted (or maybe we don't need to change the sample url ?).

@Pourfex
Copy link
Contributor

Pourfex commented Dec 28, 2023

We only support COG that are generated throught this command :

gdal_translate input.tif output.tif -of COG -co COMPRESS=LZW

This means that we need a geotiff (with CRS) and we only support LZW compression for now. This shouldn't be too hard to support other compression like JPEG (with YUV data) or deflate..

@Desplandis Desplandis self-requested a review January 8, 2024 08:44
@Desplandis Desplandis self-assigned this Jan 8, 2024
Copy link
Contributor

@Desplandis Desplandis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi and thanks for this PR! =)
In my opinion, this is a must-have feature so it is pretty nice to have started an implementation! I think we will let it as plug-in for now and integrate it in core itowns when the implementation will be mature enough.

I have a number of comments on this PR and found a number of datasets on OpenArialMaps. A lot of them failed to load since they have mask channels however!

examples/js/plugins/COGParser.js Outdated Show resolved Hide resolved
examples/js/plugins/COGParser.js Outdated Show resolved Hide resolved
examples/js/plugins/COGParser.js Outdated Show resolved Hide resolved
examples/js/plugins/COGParser.js Outdated Show resolved Hide resolved
examples/js/plugins/COGParser.js Outdated Show resolved Hide resolved
examples/js/plugins/COGSource.js Outdated Show resolved Hide resolved
examples/js/plugins/COGSource.js Show resolved Hide resolved
examples/source_file_cog.html Outdated Show resolved Hide resolved
examples/js/plugins/COGSource.js Show resolved Hide resolved
examples/js/plugins/COGParser.js Outdated Show resolved Hide resolved
@ketourneau ketourneau force-pushed the feature/add-cog branch 2 times, most recently from 00b8399 to ef4d528 Compare January 19, 2024 15:43
Copy link
Contributor Author

@ketourneau ketourneau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Desplandis I apply your code review, can you check if everything is good for you ?

examples/js/plugins/COGParser.js Outdated Show resolved Hide resolved
examples/js/plugins/COGParser.js Outdated Show resolved Hide resolved
examples/js/plugins/COGParser.js Outdated Show resolved Hide resolved
examples/js/plugins/COGParser.js Outdated Show resolved Hide resolved
examples/js/plugins/COGParser.js Outdated Show resolved Hide resolved
examples/js/plugins/COGSource.js Show resolved Hide resolved
examples/source_file_cog.html Outdated Show resolved Hide resolved
examples/js/plugins/COGSource.js Outdated Show resolved Hide resolved
this.noData = (source.noData !== undefined) ? source.noData : this.firstImage.getGDALNoData();
this.dataType = this.selectDataType(this.firstImage.getSampleFormat(), this.firstImage.getBitsPerSample());

this.channels = [];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, indeed. Actually we ignore channels to prevent some bugs.

examples/js/plugins/COGParser.js Outdated Show resolved Hide resolved
Copy link
Contributor

@Desplandis Desplandis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok to me!

@Desplandis Desplandis merged commit f707e26 into iTowns:master Jan 23, 2024
9 checks passed
AnthonyGlt pushed a commit to AnthonyGlt/itowns that referenced this pull request Feb 22, 2024
* feature: Add Cloud Optimized GeoTIFF (COG) sample

* fix(cog): Fix geotiff link

* refactor(COG): Apply code review

* fix(COG): Use readRGB instead readRasters

---------

Co-authored-by: Kevin ETOURNEAU <kevin.etourneau@sogelink.com>
@ketourneau ketourneau deleted the feature/add-cog branch February 23, 2024 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants