GDALSuggestedWarpOutput2: error out when computed dimensions are zero (fixes #15266) - #15274
Open
farzinashouri wants to merge 1 commit into
Open
farzinashouri wants to merge 1 commit into
farzinashouri wants to merge 1 commit into
Conversation
…fixes OSGeo#15266) When a source crosses the antimeridian, PROJ wraps longitudes past 180 to the far side of the globe, so the computed X extent becomes globe-wide while the Y extent stays small. The square-pixel heuristic then picks a pixel height larger than the whole Y span, and the line count rounds down to zero. AutoCreateWarpedVRT returned a 23x0 dataset instead of failing. This mirrors the existing check for dimensions that come out too large.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
When a source crosses the antimeridian, PROJ wraps longitudes past 180 to the far side of the globe, so the computed X extent becomes globe-wide while the Y extent stays small. The square-pixel heuristic in
GDALSuggestedWarpOutput2then picks a pixel height larger than the whole Y span, and the line count rounds down to zero.AutoCreateWarpedVRTreturned a 23x0 dataset instead of failing, and the problem only surfaced later as "Attempt to create 23x0 dataset is illegal".This adds a check for a zero or negative computed width or height, mirroring the existing check for dimensions that come out too large a few lines above. The failure now happens where the bad dimensions are computed.
What are related issues/pull requests?
Fixes #15266
AI tool usage
I reported the issue and diagnosed the cause, and used an AI assistant to write the patch and the test. I reviewed the change, built it locally and ran the test suite.
Tasklist
Environment