[SEDONA-626] Make ST functions return geometries with correct SRIDs #1521
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.
Did you read the Contributor Guide?
Is this PR related to a JIRA ticket?
[SEDONA-XXX] my subject
.What changes were proposed in this PR?
This PR makes geometries returned by ST functions having correct SRIDs.
ST_Transform
, the SRID of the output geometry is determined by the target CRS.Aggregation functions are not changed, making them behave correctly requires collecting the SRIDs of input geometries, which requires significant changes to the aggregation functions. We'll address that in future patches.
The way we guarantee that the ST functions produce geometries with correct SRIDs is to construct the output geometry using the GeometryFactory of the input geometry and make sure that the GeometryFactory objects of geometries have the correct SRID property. We've modified the geometry constructors and serializers to achieve this. Most of the geometry transformation methods provided by JTS use the factory of input geometries to construct outputs, so this is more error-proof than calling Geometry.setSRID everywhere.
How was this patch tested?
Passing existing tests and several newly added tests.
Did this PR include necessary documentation updates?