From 8887e41d92389d6272be7d47ab0da97e62c2bfa8 Mon Sep 17 00:00:00 2001 From: Pedersen Jarle Date: Mon, 2 May 2016 11:39:06 +0200 Subject: [PATCH 1/3] test for dimentionality and add flag to writer if 3D --- .../main/java/org/deegree/geometry/io/WKTWriter.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/deegree-core/deegree-core-geometry/src/main/java/org/deegree/geometry/io/WKTWriter.java b/deegree-core/deegree-core-geometry/src/main/java/org/deegree/geometry/io/WKTWriter.java index 5b8bd740a3..741dfbca88 100644 --- a/deegree-core/deegree-core-geometry/src/main/java/org/deegree/geometry/io/WKTWriter.java +++ b/deegree-core/deegree-core-geometry/src/main/java/org/deegree/geometry/io/WKTWriter.java @@ -1353,7 +1353,15 @@ public static void write( Geometry geom, Writer writer ) if ( writer == null ) { throw new NullPointerException( "The writer may not be null." ); } - WKTWriter wktW = new WKTWriter( null, null ); + Set flags = new HashSet(); + int dim =geom.getCoordinateDimension(); + if (dim == 3){ + flags.add( WKTWriter.WKTFlag.USE_3D ); + } + else{ + flags = null; + } + WKTWriter wktW = new WKTWriter( flags, null ); wktW.writeGeometry( geom, writer ); } From 79e9297b3394e87cc44da712d77068db008df6ac Mon Sep 17 00:00:00 2001 From: Pedersen Jarle Date: Mon, 2 May 2016 11:41:19 +0200 Subject: [PATCH 2/3] Fixed bug when asking for dimentionality of crs --- .../feature/persistence/sql/config/MappedSchemaBuilderGML.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deegree-datastores/deegree-featurestores/deegree-featurestore-sql/src/main/java/org/deegree/feature/persistence/sql/config/MappedSchemaBuilderGML.java b/deegree-datastores/deegree-featurestores/deegree-featurestore-sql/src/main/java/org/deegree/feature/persistence/sql/config/MappedSchemaBuilderGML.java index 7d157b892a..9d5495898c 100644 --- a/deegree-datastores/deegree-featurestores/deegree-featurestore-sql/src/main/java/org/deegree/feature/persistence/sql/config/MappedSchemaBuilderGML.java +++ b/deegree-datastores/deegree-featurestores/deegree-featurestore-sql/src/main/java/org/deegree/feature/persistence/sql/config/MappedSchemaBuilderGML.java @@ -156,7 +156,7 @@ public MappedSchemaBuilderGML( String configURL, List gmlSchemas, Storag gmlSchema = buildGMLSchema( configURL, gmlSchemas ); CRSRef crs = CRSManager.getCRSRef( storageCRS.getValue() ); - CoordinateDimension dim = crs.getDimension() == 3 ? DIM_2 : DIM_3; + CoordinateDimension dim = crs.getDimension() == 3 ? DIM_3 : DIM_2; geometryParams = new GeometryStorageParams( crs, storageCRS.getSrid(), dim ); // add namespace bindings From 09edb25781fd738254761943b47096feae0521db Mon Sep 17 00:00:00 2001 From: Pedersen Jarle Date: Mon, 2 May 2016 11:44:28 +0200 Subject: [PATCH 3/3] Fetch dimension from crs --- .../src/main/java/org/deegree/geometry/io/WKBWriter.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/deegree-core/deegree-core-geometry/src/main/java/org/deegree/geometry/io/WKBWriter.java b/deegree-core/deegree-core-geometry/src/main/java/org/deegree/geometry/io/WKBWriter.java index 3fe6b72e17..5555e026f2 100644 --- a/deegree-core/deegree-core-geometry/src/main/java/org/deegree/geometry/io/WKBWriter.java +++ b/deegree-core/deegree-core-geometry/src/main/java/org/deegree/geometry/io/WKBWriter.java @@ -67,12 +67,14 @@ public static byte[] write( Geometry geom ) geom = ( (GeometryReference) geom ).getReferencedObject(); } // com.vividsolutions.jts.io.WKBWriter is not thread safe - return new com.vividsolutions.jts.io.WKBWriter().write( ( (AbstractDefaultGeometry) geom ).getJTSGeometry() ); + int dim = geom.getCoordinateDimension(); + return new com.vividsolutions.jts.io.WKBWriter(dim).write( ( (AbstractDefaultGeometry) geom ).getJTSGeometry() ); } public static void write( Geometry geom, OutputStream os ) throws IOException, ParseException { // com.vividsolutions.jts.io.WKBWriter is not thread safe + //TODO: test for dimentionality here aswell? new com.vividsolutions.jts.io.WKBWriter().write( ( (AbstractDefaultGeometry) geom ).getJTSGeometry(), new OutputStreamOutStream( os ) ); }