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

External mask overviews aren't copied correctly when creating internally-masked GeoTIFFs *with statistics* #792

Closed
mojodna opened this issue Jul 24, 2018 · 0 comments
Assignees
Labels
Milestone

Comments

@mojodna
Copy link

mojodna commented Jul 24, 2018

This is almost an exact duplicate of #754. The only difference is that the 2nd gdal_translate command includes -stats to trigger the behavior.

Expected behavior and actual behavior.

Expected: internal mask overviews w/ mixed values.

Actual: internal mask overviews that are all 255.

Steps to reproduce the problem.

# COG produced using this pipeline; we're going to ignore any overviews present and
# regenerate them
curl -O https://mojodna-temp.s3.amazonaws.com/internal-mask.tif

# copy bands 1,2,3 to intermediate.tif, mask to intermediate.tif.msk
gdal_translate -b 1 -b 2 -b 3 -mask mask internal-mask.tif intermediate.tif

# add overviews (possibly resampling in a way that would be disruptive to a mask (i.e.
# introduce values that aren't 0 or 255), e.g. bicubic)
gdaladdo intermediate.tif 2 4 8 16 32

# add overviews to the mask
gdaladdo intermediate.tif.msk 2 4 8 16 32

# create an internally-masked result (this is where COG options would be applied)
gdal_translate \
  -stats \
  -co COPY_SRC_OVERVIEWS=YES \
  --config GDAL_TIFF_INTERNAL_MASK YES \
  intermediate.tif out.tif

out.tif contains all expected overviews, although each of its mask overviews is incorrect (all 255, extracted using tiffcp out.tif,7 mask-ovr1.tif for the first level).

The same overview level from intermediate.tif.msk (tiffcp intermediate.tif.msk,1 intermediate-mask-ovr1.tif for the first level) contains correct values.

Operating system

Ubuntu 16.04 64 bit (Docker)

GDAL version and provenance

GDAL release/2.3 branch (containing 12e52bc and fde9dea), built according to https://github.com/mojodna/docker-gdal/blob/v2.3.x/Dockerfile.

@rouault rouault self-assigned this Jul 24, 2018
@rouault rouault added the bug label Jul 24, 2018
@rouault rouault added this to the 2.3.2 milestone Jul 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants