bjoern@1244: BEGIN; bjoern@1244: bjoern@1244: bjoern@1244: -- Hydrologie/Einzugsgebiete/EZG.shp bjoern@1244: bjoern@1244: CREATE SEQUENCE CATCHMENT_ID_SEQ; bjoern@1244: CREATE TABLE catchment( bjoern@1244: OGR_FID NUMBER(38), bjoern@1244: GEOM MDSYS.SDO_GEOMETRY, bjoern@1244: river_id NUMBER(38), bjoern@1244: area NUMBER(19,5), bjoern@1244: name VARCHAR2(80), bjoern@1244: ID NUMBER PRIMARY KEY NOT NULL bjoern@1244: ); bjoern@1244: --EXTENT 2520667.897954 5376316.575645 2634771.191263 5508288.005707 bjoern@1244: INSERT INTO USER_SDO_GEOM_METADATA VALUES ('CATCHMENT', 'GEOM', MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',2520667.894954166,2634771.194263435,0.001),MDSYS.SDO_DIM_ELEMENT('Y',5376316.572645214,5508288.008706546,0.001),MDSYS.SDO_DIM_ELEMENT('Z',-100000,100000,0.002)), 31466); bjoern@1244: bjoern@1244: CREATE TRIGGER catchment_trigger BEFORE INSERT ON catchment FOR each ROW bjoern@1244: BEGIN bjoern@1244: SELECT CATCHMENT_ID_SEQ.nextval INTO :new.id FROM dual; bjoern@1244: END; bjoern@1244: / bjoern@1244: --/opt/gdal-1.8.0/bin/ogr2ogr -f OCI OCI:flys3/flys3@localhost EZG.shp -sql 'SELECT 1 AS river_id,AREA as area, GEBIETZBEZ as name FROM EZG' -nln catchment -append bjoern@1244: CREATE INDEX catchment_spatial_idx ON catchment(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=polygon'); bjoern@1244: bjoern@1244: -- Geodaesie/Flussachse+km/km.shp bjoern@1245: CREATE SEQUENCE RIVER_AXES_KM_ID_SEQ; bjoern@1245: CREATE TABLE river_axes_km( bjoern@1244: OGR_FID NUMBER(38), bjoern@1244: GEOM MDSYS.SDO_GEOMETRY, bjoern@1244: river_id NUMBER(38), bjoern@1244: km NUMBER(6,3), bjoern@1244: ID NUMBER PRIMARY KEY NOT NULL bjoern@1244: ); bjoern@1244: --Extent: (2539489.068000, 5450953.000500) - (2575482.527500, 5507278.634500) bjoern@1245: INSERT INTO USER_SDO_GEOM_METADATA VALUES ('river_axes_km', 'GEOM', MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',2539491.068000,2575482.527500,0.001),MDSYS.SDO_DIM_ELEMENT('Y',5450953.000500,5507278.634500,0.001),MDSYS.SDO_DIM_ELEMENT('Z',-100000,100000,0.002)), 31466); bjoern@1245: CREATE OR REPLACE TRIGGER river_axes_km_trigger BEFORE INSERT ON river_axes_km FOR each ROW bjoern@1244: BEGIN bjoern@1245: SELECT river_axes_km_ID_SEQ.nextval INTO :new.id FROM dual; bjoern@1244: END; bjoern@1244: / bjoern@1245: --/opt/gdal-1.8.0/bin/ogr2ogr -f OCI OCI:flys3/flys3@localhost km.shp -sql 'SELECT 1 AS river_id,km as km FROM km' -nln river_axes_km -append bjoern@1245: CREATE INDEX river_axes_km_spatial_idx ON river_axes_km(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=point'); bjoern@1244: bjoern@1246: -- Geodaesie/Bauwerke/Wehre.shp bjoern@1246: CREATE SEQUENCE BUILDINGS_ID_SEQ; bjoern@1246: CREATE TABLE buildings( bjoern@1246: OGR_FID NUMBER(38), bjoern@1246: GEOM MDSYS.SDO_GEOMETRY, bjoern@1246: river_id NUMBER(38), bjoern@1246: name VARCHAR2(50), bjoern@1246: ID NUMBER PRIMARY KEY NOT NULL bjoern@1246: ); bjoern@1246: --Extent: (2540544.253718, 5456266.217464) - (2567747.834199, 5502557.982120) bjoern@1246: INSERT INTO USER_SDO_GEOM_METADATA VALUES ('buildings', 'GEOM', MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',2540544.253718,2567747.834199,0.001),MDSYS.SDO_DIM_ELEMENT('Y',5456266.217464,5502557.982120,0.001),MDSYS.SDO_DIM_ELEMENT('Z',-100000,100000,0.002)), 31466); bjoern@1246: CREATE OR REPLACE TRIGGER buildings_trigger BEFORE INSERT ON buildings FOR each ROW bjoern@1246: BEGIN bjoern@1246: SELECT BUILDINGS_ID_SEQ.nextval INTO :new.id FROM dual; bjoern@1246: END; bjoern@1246: / bjoern@1246: --/opt/gdal-1.8.0/bin/ogr2ogr -f OCI OCI:flys3/flys3@localhost Wehre.shp -sql 'SELECT 1 AS river_id,Name as name FROM Wehre' -nln buildings -append bjoern@1246: CREATE INDEX buildings_spatial_idx ON buildings(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=LINE'); bjoern@1246: bjoern@1247: -- Geodaesie/Festpunkte/Festpunkte.shp bjoern@1247: CREATE SEQUENCE FIXPOINTS_ID_SEQ; bjoern@1247: CREATE TABLE fixpoints ( bjoern@1247: OGR_FID NUMBER(38), bjoern@1247: GEOM MDSYS.SDO_GEOMETRY, bjoern@1247: river_id NUMBER(38), bjoern@1247: x NUMBER(19,11), bjoern@1247: y NUMBER(19,11), bjoern@1247: km NUMBER(10) NOT NULL, bjoern@1247: HPGP VARCHAR2(254), bjoern@1247: ID NUMBER PRIMARY KEY NOT NULL bjoern@1247: ); bjoern@1247: --Extent: (2539388.036000, 5450896.688000) - (2575586.296000, 5507370.606000) bjoern@1247: INSERT INTO USER_SDO_GEOM_METADATA VALUES ('fixpoints', 'GEOM', MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',2539388.036000,2575586.296000,0.001),MDSYS.SDO_DIM_ELEMENT('Y',5450896.688000,5507370.606000,0.001),MDSYS.SDO_DIM_ELEMENT('Z',-100000,100000,0.002)), 31466); bjoern@1247: CREATE OR REPLACE TRIGGER fixpoints_trigger BEFORE INSERT ON fixpoints FOR each ROW bjoern@1247: BEGIN bjoern@1247: SELECT FIXPOINTS_ID_SEQ.nextval INTO :new.id FROM dual; bjoern@1247: END; bjoern@1247: / bjoern@1247: --/opt/gdal-1.8.0/bin/ogr2ogr -f OCI OCI:flys3/flys3@localhost Festpunkte.shp -sql 'SELECT 1 AS river_id,x as x,y as y, km as km, HPGP as HPGP FROM Festpunkte' -nln fixpoints -append bjoern@1247: CREATE INDEX fixpoints_spatial_idx ON fixpoints(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=POINT'); bjoern@1247: bjoern@1247: bjoern@1246: bjoern@1244: END;