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

Web-Optimized COG: COGEO optimized for dynamic tiling #62

Merged
merged 12 commits into from
Apr 16, 2019
Merged

Conversation

vincentsarago
Copy link
Member

Closes #10

This pr adds a --web-optimized options to create COG aligned with Web-Mercator grid.

@vincentsarago
Copy link
Member Author

vincentsarago commented Mar 13, 2019

This PR is not ready.
Right now the code doesn't not account for latitude when calculating max zoom level and mercator resolution. It works but then I the resulting data will have a different zoom coverage event if there native resolution is the scene (e.g. Landsat scene will have difference zoom coverage if we don't take latitude into account, whereas their native (before reprojection) resolution is 30m everywhere in UMT).

I'll need help to finish this PR

@vincentsarago
Copy link
Member Author

Alright I think b06ad79 fixes the problem with latitude correction.

I'll ask for some user to test it before merging it

README.rst Outdated
--overview-resampling [nearest|bilinear|cubic|cubic_spline|lanczos|average|mode|gauss] Resampling algorithm.
--overview-blocksize TEXT Overview's internal tile size (default defined by GDAL_TIFF_OVR_BLOCKSIZE env or 128)
-w, --web-optimized Create COGEO optimized for Web.
--latitude-correction Apply latitude correction to ensure max zoom equality for dataset accross different latitudes.
Copy link

Choose a reason for hiding this comment

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

@vincentsarago it's a little bit unclear to me which choice latitude correction refers to:

  1. uncorrection (== global maxzoom regardless of latitude)
  2. Maxzoom based on actual on-the-ground resolution

Copy link
Member Author

Choose a reason for hiding this comment

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

yes this was also unclear to me, when passing --latitude-correction it will adjust the resolution to match the resolution at equator (so global maxzoom regardless of latitude).

I'm not sure what default it should be then, uncorrection seems to be a better choice but this is a personal opinion

Copy link

@dnomadb dnomadb Apr 2, 2019

Choose a reason for hiding this comment

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

🤔 rather than correct / not correct (which comes with problems of semantic interpretation) what about --latitude-adjustment where True indicates that it adjusts for latitude, and False indicates that it doesn't and simply uses mercator meters.

Or, it could be --mercator-meters|--src-crs-meters which is clear (use mercator meters for calculation) but possibly obscured to those that aren't familiar with the fact that a mercator meter only ~= an on the ground meter near the equator?

Copy link
Member Author

@vincentsarago vincentsarago Apr 2, 2019

Choose a reason for hiding this comment

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

👍
the --mercator-meters|--src-crs-meters seems a bit complex even if I understand it better.

I wonder if we could do something like --latitude-adjustment|--global-maxzoom,

  • --latitude-adjustement will be the default, meaning the zoom level will be defined by the dataset mercator resolution at the given latitude (like gdal2tiles does)
  • --global-maxzoom will apply a correction factor to ensure a max_zoom corrected for global dataset

I'm not really happy with this semantic either tbh

# High resolution
# Top Left tile
mime_type, tile = cog.get_tile(0, 0, 0)
tile_lenght = 256 * 256 * 3
Copy link

Choose a reason for hiding this comment

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

Is this a spelling mistake? Should it be tile_length?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes it is, thanks @dwsilk

@vincentsarago
Copy link
Member Author

Alright this is ready. I've updated the phrasing for the latitude adjutement to --latitude-adjustment / --global-maxzoom with default being --latitude-adjustment meaning that the output zoom level will be ~equal to the native resolution at a given latitude. The --global-maxzoom will ensure MAX_ZOOM to be the same for dataset at different latitude.

@dionhaefner do you want to test this before merging it ?

@dionhaefner
Copy link
Collaborator

Please go ahead, I'd assume that testing this with Terracotta would take quite some time (which I don't have at the moment).

transform=vrt_transform,
width=vrt_width,
height=vrt_height,
resampling=Resampling[overview_resampling],
Copy link
Member Author

Choose a reason for hiding this comment

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

Well in fact this is not ready!
I added a little shortcut for the resampling method but this should be a proper options! (🎉 one more options)

@vincentsarago vincentsarago merged commit c5d7344 into master Apr 16, 2019
@vincentsarago vincentsarago deleted the webOpt branch April 19, 2019 13:23
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.

Add --web option to create ZXY tiles friendly file
4 participants