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

raster_exporter: COG support added #108

Merged
merged 12 commits into from
Sep 24, 2020
Merged

raster_exporter: COG support added #108

merged 12 commits into from
Sep 24, 2020

Conversation

griembauer
Copy link
Contributor

Raster exporter does not yet support COG, for which GDAL >= 3.1 is required. Current workaround because of GDAL bug in overview creation.

Status: should work for now, but more elegant solution to come after GDAL bugfix

@griembauer griembauer added the enhancement New feature or request label Sep 17, 2020
@metzm
Copy link
Contributor

metzm commented Sep 18, 2020

The bug in COG creation is caused by color table export. The COG driver sets a TIFF color table even if this is not supported by the TIFF specs. With TIFF, color tables can only be set for datatypes Byte and UInt16. Therefore we need to explicitly set the "-c" flag with r.out.gdal when exporting to COG.

@@ -128,7 +128,7 @@ def __init__(self):

@swagger.doc({
'tags': ['Raster Management'],
'description': 'Export an existing raster map layer as GeoTiff using the raster map layer specific region. '
'description': 'Export an existing raster map layer as GeoTiff or COG (if COG driver available) using the raster map layer specific region. '
Copy link
Member

Choose a reason for hiding this comment

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

I think the upper text is better. This sounds more like having a choice

args.extend(["createopt=COMPRESS=LZW,TILED=YES", "overviews=5"])

# current workaround due to color table export
# TODO: DELETE AND TEST ONCE GDAL 3.2 HAS BEEN RELEASED
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# TODO: DELETE AND TEST ONCE GDAL 3.2 HAS BEEN RELEASED
# TODO: DELETE AND TEST ONCE GDAL 3.1.4 HAS BEEN RELEASED

griembauer and others added 2 commits September 18, 2020 14:49
Co-authored-by: Markus Neteler <neteler@gmail.com>
Co-authored-by: Markus Metz <33666869+metzm@users.noreply.github.com>
Co-authored-by: Markus Metz <33666869+metzm@users.noreply.github.com>
@neteler
Copy link
Member

neteler commented Sep 21, 2020

I have the impression that COG requires BIGTIFF activation (the implemented auto-detection failed for me several times). And also compression to be activated, as there is none set as the default: https://gdal.org/drivers/raster/cog.html#general-creation-options ).

Any COG > 4GB was corrupted for me (GDAL 3.1.2 on Alpine).

Hence, e.g.:

r.out.gdal ... format=COG createopt="COMPRESS=LZW,BIGTIFF=YES"

But with that I get:

Warning 6: driver MEM does not support creation option COMPRESS
Warning 6: driver MEM does not support creation option BIGTIFF

Does @metzm have an idea?

@neteler neteler deleted the COG_export branch September 29, 2020 09:47
@mmacata mmacata added this to the 0.99.X milestone Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update raster exporter to also support COG (cloud optimized GeoTIFF)
5 participants