-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Fix QgsCsException messages #59484
Fix QgsCsException messages #59484
Conversation
We were incorrectly showing the "transformed" coordinate result in the exception message, which usually ended up inf, inf after the transform fails. This lead to a useless 'forward transform of (inf, inf)' message in the exception, which was misleading as it looks like we were trying to transform a (inf, inf) point. Now we get the (useful!) actual coordinate we were trying to transform in the exception message.
The old code mistakenly assumed that proj error codes were all values < 0, which they haven't been since proj 8.0 This meant all QgsCsExceptions were incorrectly including "Error: Fallback transform failed", instead of the actual error message from proj. Now we get eg "Forward transform of (-7603859.000000, -7324441.000000) Error: Invalid coordinate", which makes much more sense
Eg: Forward transform (EPSG:4326 to EPSG:3857) of (-7603859.000000, -7324441.000000) Error: Invalid coordinate
@rouault One thing I can't work out how to fix is the hardcoded -61 error number here: https://github.com/qgis/QGIS/blob/master/src/core/proj/qgscoordinatetransform_p.cpp#L335 . I gather that would have been changed by OSGeo/PROJ#2487, but I'm not 100% sure what the corresponding constant should be. Is it PROJ_ERR_COORD_TRANSFM_NO_OPERATION ? |
🪟 Windows buildsDownload Windows builds of this PR for testing. 🪟 Windows Qt6 buildsDownload Windows Qt6 builds of this PR for testing. |
I believe |
@rouault ok, removed |
The backport to
stderr
stdout
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-queued_ltr_backports queued_ltr_backports
# Navigate to the new working tree
cd .worktrees/backport-queued_ltr_backports
# Create a new branch
git switch --create backport-59484-to-queued_ltr_backports
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick c8d25f6ceff4450687c5ad29d09e3686dd3f59d4,276cbec30e9a44ce383d37fbbb6e8837b95483ee,00c7268020aab2516efa49cbba43566b80cc9c82,16de21a78ec15fa3c9f2add0829a81c57874b33c,9b69cafa16b775611515c45762ab378c398b2840,b682d36b06f20065994b0707f1306a6c295b8790,5733e3d3f2cd60942356f2a6f586fdbcf3eaea19
# Push it to GitHub
git push --set-upstream origin backport-59484-to-queued_ltr_backports
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-queued_ltr_backports Then, create a pull request where the |
Heh... for the longest time I thought the useless
forward transform of (inf, inf)
exceptions messages contained within QgsCsException were just proj not giving very useful error messages... but it turns out our QgsCsException message generation logic was completely wonky and generating nonsense messages.Let's fix that!
Instead of:
we now get much more useful exceptions, like:
QgsCsException: Forward transform (EPSG:4326 to EPSG:3857) of (-7603859.000000, -7324441.000000) Error: Invalid coordinate