# HG changeset patch # User Andre Heinecke # Date 1362650024 -3600 # Node ID 8aac391871f9fb1175529ddb8812af0d9711fecd # Parent 9d36ddf7dbd311e85973412108d06984858484cf SCHEME CHANGE: Hydr.Boundaries are now three dimensional multilinestrings diff -r 9d36ddf7dbd3 -r 8aac391871f9 flys-backend/contrib/shpimporter/boundaries.py --- 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): diff -r 9d36ddf7dbd3 -r 8aac391871f9 flys-backend/doc/schema/oracle-spatial_idx.sql --- 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'); diff -r 9d36ddf7dbd3 -r 8aac391871f9 flys-backend/doc/schema/postgresql-spatial.sql --- 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'); diff -r 9d36ddf7dbd3 -r 8aac391871f9 flys-backend/src/main/java/de/intevation/flys/model/HydrBoundary.java --- 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; }