CRS change crashes with grid-based projections when layer resolution limits are configured #12627 - #12669
Conversation
|
Converted to draft waiting for 2026.02.00 to be out |
offtherailz
left a comment
There was a problem hiding this comment.
Good,
Two things before merge in inline suggestions you can apply:
- guard + warning if conversion fails
- fix to the unit coneversion (if passing, for instance, from meeters to degrees etc). I attached a test. Please verify that makes sense to you too.
Could you please verify that the changes I suggested still fits our use case and they work well also in different latitude with inverse conversion @rowheat02 ? thank you.
…on CRS change The converted limits were snapped to a resolution of the target CRS, but getResolutions returns the resolutions configured in mapOptions.view for any SRS, which on the way back is the previous CRS ladder: metres ended up snapped onto degrees. Convert through the meters-per-unit ratio instead, the same one the map view uses to keep the scale, and drop the snap so the conversion is reversible.
|
Pushed a commit on top of yours with the fix for the problem you found. The conversion itself was fine after the suggestions; what broke the round trip was the snap. So the limits are now converted through the meters-per-unit ratio of the two CRS - the same ratio What to test:
Two pre-existing problems came up while testing this, unrelated to the PR; I will open them |
|
Backport failed for |
|
@rowheat02 the automatic backport failed, please provide a new backport |
|
Backport for 2026.02.xx has been created manually: #12762 |
Description
This PR fixes the CRS change when the target projection uses a datum grid and some layers have
minResolutionormaxResolutionconfigured.The resolution conversion was transforming a point to the target CRS and then using it with the source projection. This could generate invalid coordinates and crash the CRS change when the target projection requires a datum-grid correction.
While fixing this, we also found an issue when switching the CRS back and forth. For example:
EPSG:25830 → EPSG:4326 → EPSG:25830The converted resolution limits were snapped to the resolution list, so they did not return to their original values. Because of this, layers that were visible before the CRS change could become invisible after switching back.
The limits are now converted using the meters-per-unit ratio without snapping, making the conversion reversible.
Please check if the PR fulfills these requirements
What kind of change does this PR introduce? (check one with "x", remove the others)
Issue
What is the current behavior?
#12627
The CRS change can fail with datum-grid projections when layer resolution limits are configured. Switching the CRS back and forth can also change the limits and make visible layers invisible.
What is the new behavior?
The CRS changes without crashing, and layer resolution limits remain stable after multiple CRS changes.
Breaking change
Does this PR introduce a breaking change? (check one with "x", remove the other)
Other useful information