Skip to content
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

[SEDONA-626] Make ST functions return geometries with correct SRIDs #1521

Merged
merged 5 commits into from
Jul 14, 2024

Conversation

Kontinuation
Copy link
Member

@Kontinuation Kontinuation commented Jul 11, 2024

Did you read the Contributor Guide?

Is this PR related to a JIRA ticket?

What changes were proposed in this PR?

This PR makes geometries returned by ST functions having correct SRIDs.

  • For geometry manipulation functions, the SRID of the output geometry should be the same as the input geometry.
  • For 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?

  • No, this PR affects the behavior of some public APIs but I'd like to treat them as bugfixes.

@jiayuasu jiayuasu added this to the sedona-1.6.1 milestone Jul 14, 2024
@jiayuasu jiayuasu added the bug label Jul 14, 2024
@jiayuasu jiayuasu merged commit 658bf60 into apache:master Jul 14, 2024
50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants