-
Notifications
You must be signed in to change notification settings - Fork 442
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
Writing and reading WKB loses M dimension #733
Comments
I think you've identified a bug here. Any interest in working on it? The Contributing guide has some info about that here: https://github.com/locationtech/jts/blob/master/CONTRIBUTING.md |
Yes sure. Currently I'm using a workaround with a When thinking of a fix my first thought was to do an When looking at the |
M coordinate is read as Z coordinate after writing/reading.
Referring to WKTReader/WKTWriter I added the EnumSet<Ordinate> ordinateFlags. The WKBWriter uses these ordinateFlags to set the correct flags on the byte stream.
Referring to WKTReader/WKTWriter I added the EnumSet<Ordinate> ordinateFlags. The WKBWriter uses these ordinateFlags to set the correct flags on the byte stream. Signed-off-by: Kai Winter <[email protected]>
M coordinate is read as Z coordinate after writing/reading.
Referring to WKTReader/WKTWriter I added the EnumSet<Ordinate> ordinateFlags. The WKBWriter uses these ordinateFlags to set the correct flags on the byte stream. Signed-off-by: Kai Winter <[email protected]>
* Unit test for #733 M coordinate is read as Z coordinate after writing/reading. * Fixed lost M coordinates (#733) Referring to WKTReader/WKTWriter I added the EnumSet<Ordinate> ordinateFlags. The WKBWriter uses these ordinateFlags to set the correct flags on the byte stream. Signed-off-by: Kai Winter <[email protected]> * Fixed Javadoc and exception message * Fixed handling of XYZM coordinates Signed-off-by: Kai Winter <[email protected]> # Conflicts: # modules/core/src/main/java/org/locationtech/jts/io/WKBWriter.java --------- Signed-off-by: Kai Winter <[email protected]>
When using
WKBWriter
to write a Geometry which has XYM coordinates and afterwards usingWKBReader
for reading the result. The Geometry has XYZ coordinates instead of XYM coordinates.Here is small example:
When running this you get the following output:
The
geometryBefore
has XYM coordinates. ThegeometryAfter
has XYZ coordinates.In
WKBReader.readGeometry
are two variables evaluatedhasZ
andhasM
. In the above examplehasZ
is true andhasM
is false. I think this is becauseWKBWriter.writeGeometryType
always writes0x80000000
regardless of the coordinate type. DebuggingWKBReader.readGeometry
makes me think0x40000000
should be used for M coordinates inWKBWriter.writeGeometryType
.What do you think? Can this be improved or did I just misunderstood how this should work.
The text was updated successfully, but these errors were encountered: