-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[gdalwarp] Fix -ovr #10193
[gdalwarp] Fix -ovr #10193
Conversation
apps/gdalwarp_lib.cpp
Outdated
GDALDatasetH hDstDSOverview = nullptr; | ||
if (psOptions->nOvLevel >= 0) | ||
{ | ||
hDstDSOverview = GDALCreateOverviewDataset( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will leak hDstDSOverview, and more annoyingly this will crash if nSrcCount > 1.
I believe the call to GDALCreateOverviewDataset() should be moved to CreateOutput() and applied to all input datasets
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, it's much more complex that I imagined.
I think I have now the proper implementation but there is still a failing test that I don't know how to handle (what is the expected behavior):
# Crates a full res output file
gdaltest.runexternal(f"{gdalwarp_path} {src_tif} {dst_tif}")
# The output file has now a "wrong" resolution and no overwrite was specified
gdaltest.runexternal(f"{gdalwarp_path} {src_tif} {dst_tif} -ovr 0")
ds = gdal.Open(dst_tif)
# Fail! Full res is used instead of overview
assert ds.GetRasterBand(1).Checksum() == cs_ov0
What are we supposed to do here?
Error out or silently overwrite the output file (that has full res instead of the ovr res)?
The code path in this case skips createOutput completely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are we supposed to do here?
Error out or silently overwrite the output file (that has full res instead of the ovr res)?
There should already be a warning emitted at line 2860 (in master): "cannot get overview level ...". This is probably enough for now
e63a88d
to
f224d56
Compare
Fix OSGeo#10174 -ovr {absolute_value} doesn't influence choice of output resolution
f224d56
to
63c9bd0
Compare
Fix #10174 -ovr {absolute_value} doesn't influence choice of output resolution