Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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
Kontinuation added a commit to Kontinuation/sedona that referenced this pull request Oct 11, 2024
…pache#1521)

* Deserialized geometries have factories with proper SRID values

* The SRIDs of geometries could be persisted in transformations

* Fix handling of SRIDs for hex-wkb constructors

* Fix handling of SRIDs for hex-wkb constructors

* Add Spark tests for SRID preserving ST functions
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