Skip to content

Simplify passing options to gdal raster overview add ? #12446

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

Open
dbaston opened this issue May 22, 2025 · 1 comment
Open

Simplify passing options to gdal raster overview add ? #12446

dbaston opened this issue May 22, 2025 · 1 comment
Labels
enhancement gdal_cli Anything related to the new 3.11 "gdal" CLI frontend

Comments

@dbaston
Copy link
Member

dbaston commented May 22, 2025

Feature description

I'm looking at an example from https://blog.cleverelephant.ca/2015/02/geotiff-compression-for-dummies.html, where we first convert a raster:

gdal_translate \
  -b 1 -b 2 -b 3 \
  -co COMPRESS=JPEG \
  -co JPEG_QUALITY=50 \
  -co PHOTOMETRIC=YCBCR \
  -co TILED=YES \
  5255C.tif 5255C_JPEG_YCBCR_50.tif

and then add overviews

gdaladdo \
  --config COMPRESS_OVERVIEW JPEG \
  --config JPEG_QUALITY_OVERVIEW 50 \
  --config PHOTOMETRIC_OVERVIEW YCBCR \
  --config INTERLEAVE_OVERVIEW PIXEL \
  -r average \
  5255C_JPEG_YCBCR_50.tif \
  2 4 8 16

As far as I can see, this is best replaced in the new CLI by

gdal raster pipeline ! \
  read 5255C.tif ! \
  select 1 2 3 ! \
  write 5255C_JPEG_YCBCR_50.tif \ 
  --co COMPRESS=JPEG \
  --co JPEG_QUALITY=50 \
  --co PHOTOMETRIC=YCBCR \
  --co TILED=YES

gdal raster overview add \
   5255C_JPEG_YCBCR_50.tif \
  --config COMPRESS_OVERVIEW JPEG \
  --config JPEG_QUALITY_OVERVIEW 50 \
  --config PHOTOMETRIC_OVERVIEW YCBCR \
  --config INTERLEAVE_OVERVIEW PIXEL \
   --levels 2,4,8,16

As a developer I understand why we are using --co in one case and --config in the other, but I'm not sure it's terribly obvious to a user. If we are creating an overview, should creation option --co COMPRESS=JPEG be understood to apply to that overview? In this case it makes sense, but I'm not sure blurring the lines between creation and configuration options, as a general practice, would actually reduce confusion.

Additional context

No response

@dbaston dbaston added enhancement gdal_cli Anything related to the new 3.11 "gdal" CLI frontend labels May 22, 2025
@rouault
Copy link
Member

rouault commented May 22, 2025

Small remark: in both gdaladdo and gdal raster overview add case, in your above scenario, none of the config options should be necessary as the GeoTIFF driver will use by default the settings from the full resolution dataset

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement gdal_cli Anything related to the new 3.11 "gdal" CLI frontend
Projects
None yet
Development

No branches or pull requests

2 participants