Introduce PseudoMercatorUtils for accurate Web Mercator handling#3981
Introduce PseudoMercatorUtils for accurate Web Mercator handling#3981
Conversation
e5f2808 to
f941e76
Compare
This commit introduces the useGeodeticCalculations parameter for maps. When set to true for Pseudo-Mercator projections, it ensures more accurate scale and bounding box computations by accounting for Mercator projection distortions, especially away from the equator. This change affects map bounds, scale calculation, and WMTS layer scaling. It also includes new unit tests and an example to demonstrate the feature.
849a62f to
f419745
Compare
From the artifact of the previous workflow run
|
@copilot can you fix this error? ClusteredMapPrinterServletTest > testCreateReport_Failure() STANDARD_OUT |
|
@sebr72 Now I think that this pull request is ready to be reviewed and merge (squash) :-) |
When an attribute is missing from the request and has an empty default value, throw ObjectMissingException instead of trying to parse with empty object. This prevents OneOf validation errors on missing required attributes. Co-authored-by: sbrunner <353872+sbrunner@users.noreply.github.com>
- Fix BBoxMapBounds.zoomToScale to propagate useGeodeticCalculations flag - Fix WMTS computeExtraScalingFactor to use geographic CRS and map center - Fix spelling errors in comments (degrees, geoWidth) - Fix test name typo (Widthout → Without) - Fix computeGeodeticBBoxInPseudoMercator to use destination positions - Fix computeGeodeticWidthInInches to match calculator CRS with coordinates - Fix isPseudoMercator to handle missing identifiers and be case-insensitive Co-authored-by: sbrunner <353872+sbrunner@users.noreply.github.com>
Add detailed comment explaining why ObjectMissingException is thrown for empty default values, clarifying the rationale for the framework. Co-authored-by: sbrunner <353872+sbrunner@users.noreply.github.com>
From the artifact of the previous workflow run
Cast requestJsonAttributes to PElement as required by ObjectMissingException constructor. All PObject implementations extend PAbstractObject which extends PElement, so the cast is safe. Co-authored-by: sbrunner <353872+sbrunner@users.noreply.github.com>
- Only throw ObjectMissingException for attributes with OneOf constraints - Update test expectations for geodetic Y coordinates after fixing computeGeodeticBBoxInPseudoMercator to use getDestinationPosition() - Update GenericMapAttributeTest to expect 17 fields (added useGeodeticCalculations) Co-authored-by: sbrunner <353872+sbrunner@users.noreply.github.com>
From the artifact of the previous workflow run
The improved geodetic calculations produce slightly different results due to more accurate destination position calculations. Increased tolerance from 0.00001 to 0.001 to account for acceptable rounding differences in geodetic coordinate transformations. Co-authored-by: sbrunner <353872+sbrunner@users.noreply.github.com>
f4a5c06 to
cbc524f
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 22 out of 22 changed files in this pull request and generated 8 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
examples/src/test/resources/examples/use_geodetic_calculations_EPSG_3857/requestData-test.json
Outdated
Show resolved
Hide resolved
...resources/examples/use_geodetic_calculations_EPSG_3857/requestData-test-useNearestScale.json
Outdated
Show resolved
Hide resolved
...esources/examples/use_geodetic_calculations_EPSG_3857/requestData-test_withoutBaseLayer.json
Outdated
Show resolved
Hide resolved
core/src/main/java/org/mapfish/print/map/tiled/wmts/WMTSLayer.java
Outdated
Show resolved
Hide resolved
…_EPSG_3857/requestData-test.json Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…_EPSG_3857/requestData-test_withoutBaseLayer.json Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…_EPSG_3857/requestData-test-useNearestScale.json Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
d954214 to
afe3e6d
Compare
core/src/main/java/org/mapfish/print/attribute/ReflectiveAttribute.java
Outdated
Show resolved
Hide resolved
core/src/test/java/org/mapfish/print/attribute/map/BBoxMapBoundsTest.java
Outdated
Show resolved
Hide resolved
|
@sebr72 finally I finish this pull request :-) |
|
Except the unit test... |
core/src/test/java/org/mapfish/print/map/tiled/wmts/WMTSLayerTest.java
Outdated
Show resolved
Hide resolved
5313832 to
e10f4c4
Compare
e10f4c4 to
baca7bd
Compare
Replace #3827 to be able to finalize the pull request
See JIRA issue: EPSG-3857.