changeset 5182:8aac391871f9

SCHEME CHANGE: Hydr.Boundaries are now three dimensional multilinestrings
author Andre Heinecke <aheinecke@intevation.de>
date Thu, 07 Mar 2013 10:53:44 +0100
parents 9d36ddf7dbd3
children 0a83a796f7cf e8e092c00791
files flys-backend/contrib/shpimporter/boundaries.py flys-backend/doc/schema/oracle-spatial_idx.sql flys-backend/doc/schema/postgresql-spatial.sql flys-backend/src/main/java/de/intevation/flys/model/HydrBoundary.java
diffstat 4 files changed, 13 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/flys-backend/contrib/shpimporter/boundaries.py	Thu Mar 07 10:44:27 2013 +0100
+++ b/flys-backend/contrib/shpimporter/boundaries.py	Thu Mar 07 10:53:44 2013 +0100
@@ -4,6 +4,7 @@
     import ogr
 
 from importer import Importer
+import utils
 
 TABLE_NAME="hydr_boundaries"
 TABLE_NAME_POLY="hydr_boundaries_poly"
@@ -23,7 +24,10 @@
         return NAME
 
     def isGeometryValid(self, geomType):
-        return geomType == ogr.wkbLineString
+        return geomType in [ogr.wkbLineString,
+                            ogr.wkbLineString25D,
+                            ogr.wkbMultiLineString25D,
+                            ogr.wkbMultiLineString]
 
     def isShapeRelevant(self, name, path):
         shp = ogr.Open(path)
@@ -48,7 +52,7 @@
 
         newFeat  = ogr.Feature(featureDef)
         geometry = feat.GetGeometryRef()
-        geometry.SetCoordinateDimension(2)
+        geometry.SetCoordinateDimension(3)
 
         newFeat.SetGeometry(geometry)
         newFeat.SetField("name", args['name'])
@@ -64,7 +68,7 @@
         else:
             newFeat.SetField("river_id", self.river_id)
 
-        return newFeat
+        return utils.convertToMultiLine(newFeat)
 
 class HydrBoundaryPoly(HydrBoundary):
 
--- a/flys-backend/doc/schema/oracle-spatial_idx.sql	Thu Mar 07 10:44:27 2013 +0100
+++ b/flys-backend/doc/schema/oracle-spatial_idx.sql	Thu Mar 07 10:53:44 2013 +0100
@@ -22,7 +22,7 @@
 
 -- TODO: index prevents importing on 11g.
 -- Error: "Ebenendimensionalitat stimmt nicht mit Geometrie-Dimensionen uberein"
--- CREATE INDEX hydr_boundaries_idx ON hydr_boundaries(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=LINE');
+-- CREATE INDEX hydr_boundaries_idx ON hydr_boundaries(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=MULTILINE');
 
 CREATE INDEX hws_points_spatial_idx ON hws_points(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=POINT');
 CREATE INDEX hws_lines_spatial_idx ON hws_lines(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=MULTILINE');
--- a/flys-backend/doc/schema/postgresql-spatial.sql	Thu Mar 07 10:44:27 2013 +0100
+++ b/flys-backend/doc/schema/postgresql-spatial.sql	Thu Mar 07 10:53:44 2013 +0100
@@ -255,7 +255,7 @@
     sobek      int REFERENCES sobek_kinds(id),
     path       VARCHAR(256)
 );
-SELECT AddGeometryColumn('hydr_boundaries','geom',31467,'LINESTRING',3);
+SELECT AddGeometryColumn('hydr_boundaries','geom',31467,'MULTILINESTRING',3);
 ALTER TABLE hydr_boundaries ALTER COLUMN id SET DEFAULT NEXTVAL('HYDR_BOUNDARIES_ID_SEQ');
 
 
--- a/flys-backend/src/main/java/de/intevation/flys/model/HydrBoundary.java	Thu Mar 07 10:44:27 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/model/HydrBoundary.java	Thu Mar 07 10:53:44 2013 +0100
@@ -17,7 +17,7 @@
 import org.hibernate.Query;
 import org.hibernate.annotations.Type;
 
-import com.vividsolutions.jts.geom.LineString;
+import com.vividsolutions.jts.geom.MultiLineString;
 
 import de.intevation.flys.backend.SessionHolder;
 
@@ -32,7 +32,7 @@
     private SobekKind  sobek;
     private String     name;
     private River      river;
-    private LineString geom;
+    private MultiLineString geom;
     private BoundaryKind kind;
 
     public HydrBoundary() {
@@ -82,12 +82,12 @@
 
     @Column(name = "geom")
     @Type(type = "org.hibernatespatial.GeometryUserType")
-    public LineString getGeom() {
+    public MultiLineString getGeom() {
         return geom;
     }
 
 
-    public void setGeom(LineString geom) {
+    public void setGeom(MultiLineString geom) {
         this.geom = geom;
     }
 

http://dive4elements.wald.intevation.org