-
Notifications
You must be signed in to change notification settings - Fork 654
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-351] Support XYZM coordinate #956
Conversation
@@ -254,7 +254,17 @@ public static Geometry transform(Geometry geometry, CoordinateReferenceSystem so | |||
} | |||
|
|||
public static int getDimension(Geometry geometry) { | |||
return geometry.getCoordinate() != null && !java.lang.Double.isNaN(geometry.getCoordinate().getZ()) ? 3 : 2; | |||
int dimension = 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is duplicate to nDims(): https://github.com/apache/sedona/blob/master/common/src/main/java/org/apache/sedona/common/Functions.java#L298
Please copy the logic of nDims here and let nDims function call this getDimension function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it.
@Test | ||
public void asEWKT() throws Exception{ | ||
Geometry geometry = GEOMETRY_FACTORY.createPoint(new Coordinate(1.0, 2.0)); | ||
String actualResult = Functions.asEWKT(geometry); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea.
I added SRID in them.
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?
GetDimension will support 2D and 3D, which will lead functions like ST_AsWKT ignore the M coordinate. After this PR is merged, M coordinate will be available in WKT format.
In short, current status of Sedona Input and Output ST functions are follows:
Sedona Jvm serializer will carry XYZM + SRID. So any ST functions in Sedona can access XYZM in the geometry type.
Shapely serializer does not support M so when deal with data created by Shapely, M is ignored.
How was this patch tested?
Comprehensive unit tests in sedona-common
Did this PR include necessary documentation updates?