-
Notifications
You must be signed in to change notification settings - Fork 178
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
SRID not preserved in Geometry types (Point) since it is encoded as text using the WKTWriter #542
Comments
Thanks for the report. Would you be interested in submitting a pull request (and potentially reviewing the other geometry codecs)? I'm happy to provide further guidance. However, I'm not familiar with geometry specifics and happy to collaborate on the fix. FWIW, we plan to ship another service release tomorrow, so we have an excellent opportunity to ship a fix for this issue timely. |
@mp911de Thanks for the quick response! I want to contribute a solution for this, but I'm not sure what the best way forward is. The thing is, Postgis supports 2, 3, and 4 dimension geometries ( |
The official postgis java package also does not support more than two dimensions at the moment: https://github.com/postgis/postgis-java/blob/a01a8c899e9835afbbd78e8057959ecdba6738c0/postgis-jdbc-jts/src/main/java/net/postgis/jdbc/jts/JtsBinaryWriter.java#L77-L78 |
We're using JTS objects. I would expect that the |
We now use WKBWriter with two dimensions preserving the SRID. Add integration tests for Postgis. [resolves #542] Signed-off-by: Mark Paluch <mpaluch@vmware.com>
I fixed the issue by using your suggested workaround and added an integration test. |
@mp911de Oh wow haha, that works as well! It is kinda hard to know how many dimensions there are since Geometry can be nested as GeometryCollections / MultiLineString / LineString with the dimensions only known in the nested points so it's kinda hard to decide this automatically. I couldn't directly find a way to do so. At least this fixes my issue for now. Thanks a lot! |
Me neither, either someone more knowledgeable will show up and help us or things are fine as they are now. In any case, thanks for your support. |
Bug Report
I'm trying to store JTS Points in a
geometry(Point,4326)
type column. This fails since the SRID is not encoded in the encoded representation.Versions
Current Behavior
Inserting a Point with SRID into a
geometry(Point,4326)
column results in the following error.Steps to reproduce
This is how Geometries are currently encoded in
PostgisGeometryCodec
:This drops the SRID from the geometry as shown with this example:
Expected behavior/workaround
Either EWKT or (E)WKB representations should be used when encoding Geometries, these can encode the SRID properly.
For our purposes a workaround that seems to help is encoding the geometries as WKB before inserting (we use Spring Data, so this is easy using
Converter
s):The text was updated successfully, but these errors were encountered: