Geometry class cannot handle 3D WKT
See original GitHub issueDriver version
SQL Server version
Microsoft SQL Server 2019 (RTM) - 15.0.2000.5 (X64) Sep 24 2019 13:48:23 Copyright © 2019 Microsoft Corporation Developer Edition (64-bit) on Linux (Ubuntu 16.04.6 LTS) <X64>
Client Operating System
Linux Mint 19.2 (SQLServer is running in the official docker images)
JAVA/JVM version
OpenJDK 1.8.0_232
Table schema
No table needed.
Problem description
The JDBC driver (and the routines inside the database too) cannot handle geometries with Z as specified in the OGC Simple Feature Specitication, see “7.2.3 BNF Productions for Three-Dimension Geometry WKT”
- Expected behaviour: the code (and the database should parse a valid 3D WKT expression
- Actual behaviour: it does not, claims Z is invalid
- Error message/stack trace:
Exception in thread "main" com.microsoft.sqlserver.jdbc.SQLServerException: Carattere non valido in Well-Known text alla posizione 12.
at com.microsoft.sqlserver.jdbc.SQLServerSpatialDatatype.throwIllegalWKTPosition(SQLServerSpatialDatatype.java:1835)
at com.microsoft.sqlserver.jdbc.SQLServerSpatialDatatype.checkEmptyKeyword(SQLServerSpatialDatatype.java:1489)
at com.microsoft.sqlserver.jdbc.SQLServerSpatialDatatype.parseWKTForSerialization(SQLServerSpatialDatatype.java:380)
at com.microsoft.sqlserver.jdbc.Geometry.<init>(Geometry.java:39)
at com.microsoft.sqlserver.jdbc.Geometry.parse(Geometry.java:128)
at org.geotools.data.sqlserver.GeometryZTest.main(GeometryZTest.java:9)
- Any other details that can be helpful: Code to reproduce:
import com.microsoft.sqlserver.jdbc.Geometry;
import com.microsoft.sqlserver.jdbc.SQLServerException;
public class GeometryZTest {
public static void main(String[] args) throws SQLServerException {
Geometry geometry = Geometry.parse("LINESTRING Z(0 0 0, 1 1 1)");
}
}
As an addition, the same problem seems to happen with WKB, the code (and the database routines) cannot parse a valid 3D geometry encoding. To generate such encodings I’d suggest to use the Java Topology Suite WKTWriter and WKBWriter classes.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Oracle 3D WKT? — oracle-tech
I have tried your stated trick of using WKT as a medium between MDSYS. SDO_GEOMETRY and SDE. ST_GEOMETRY using supported "simple" 2D geometries ......
Read more >Float point problems using Shapely using WKT
1 Answer 1 ... Knowing that Shapely and GEOS cannot reduce precision (floating-point precision problem, How to deal with rounding errors in ...
Read more >Circle, Arcs and user defined Geometries and WKT conversion
Circle geometry exists in OpenLayers but because GeometryEncoder in ... WKT conversion that excludes Circle geometry type to be handles ...
Read more >Convert java.lang.String geometry to jts Geometry
I assume that your geometry has the WKT (Well Known Text) format. If not, you can get it in the WKT format by...
Read more >Geometry — pygeos documentation - Read the Docs
Geometry class is the central datatype in PyGEOS. An instance of Geometry is a container of the actual GEOSGeometry object. The Geometry object...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Reported here: https://feedback.azure.com/forums/908035-sql-server/suggestions/39560161-3d-wkt-support
Closing the issue as it’s not a driver issue.