Mercurial > dive4elements > river
view flys-backend/doc/schema/oracle-spatial.sql @ 1254:3d4eb1abe23e
Added inital oracle-spatial_idx.sql script.
flys-backend/trunk@2748 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Bjoern Schilberg <bjoern@intevation.de> |
---|---|
date | Wed, 14 Sep 2011 14:52:59 +0000 |
parents | a75e7d922942 |
children | e1fb4a1e0b4a |
line wrap: on
line source
-- Hydrologie/Einzugsgebiete/EZG.shp CREATE SEQUENCE CATCHMENT_ID_SEQ; CREATE TABLE catchment( OGR_FID NUMBER(38), GEOM MDSYS.SDO_GEOMETRY, river_id NUMBER(38), area NUMBER(19,5), name VARCHAR2(80), ID NUMBER PRIMARY KEY NOT NULL ); --EXTENT 2520667.897954 5376316.575645 2634771.191263 5508288.005707 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); CREATE TRIGGER catchment_trigger BEFORE INSERT ON catchment FOR each ROW BEGIN SELECT CATCHMENT_ID_SEQ.nextval INTO :new.id FROM dual; END; / --/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 --CREATE INDEX catchment_spatial_idx ON catchment(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=polygon'); -- Geodaesie/Flussachse+km/km.shp CREATE SEQUENCE RIVER_AXES_KM_ID_SEQ; CREATE TABLE river_axes_km( OGR_FID NUMBER(38), GEOM MDSYS.SDO_GEOMETRY, river_id NUMBER(38), km NUMBER(6,3), ID NUMBER PRIMARY KEY NOT NULL ); --Extent: (2539489.068000, 5450953.000500) - (2575482.527500, 5507278.634500) 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); CREATE OR REPLACE TRIGGER river_axes_km_trigger BEFORE INSERT ON river_axes_km FOR each ROW BEGIN SELECT river_axes_km_ID_SEQ.nextval INTO :new.id FROM dual; END; / --/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 --CREATE INDEX river_axes_km_spatial_idx ON river_axes_km(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=point'); -- Geodaesie/Bauwerke/Wehre.shp CREATE SEQUENCE BUILDINGS_ID_SEQ; CREATE TABLE buildings( OGR_FID NUMBER(38), GEOM MDSYS.SDO_GEOMETRY, river_id NUMBER(38), name VARCHAR2(50), ID NUMBER PRIMARY KEY NOT NULL ); --Extent: (2540544.253718, 5456266.217464) - (2567747.834199, 5502557.982120) 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); CREATE OR REPLACE TRIGGER buildings_trigger BEFORE INSERT ON buildings FOR each ROW BEGIN SELECT BUILDINGS_ID_SEQ.nextval INTO :new.id FROM dual; END; / --/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 --CREATE INDEX buildings_spatial_idx ON buildings(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=LINE'); -- Geodaesie/Festpunkte/Festpunkte.shp CREATE SEQUENCE FIXPOINTS_ID_SEQ; CREATE TABLE fixpoints ( OGR_FID NUMBER(38), GEOM MDSYS.SDO_GEOMETRY, river_id NUMBER(38), x NUMBER(19,11), y NUMBER(19,11), km NUMBER(10) NOT NULL, HPGP VARCHAR2(254), ID NUMBER PRIMARY KEY NOT NULL ); --Extent: (2539388.036000, 5450896.688000) - (2575586.296000, 5507370.606000) 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); CREATE OR REPLACE TRIGGER fixpoints_trigger BEFORE INSERT ON fixpoints FOR each ROW BEGIN SELECT FIXPOINTS_ID_SEQ.nextval INTO :new.id FROM dual; END; / --/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 --CREATE INDEX fixpoints_spatial_idx ON fixpoints(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=POINT'); -- Geodaesie/Flussachse+km/achse CREATE SEQUENCE RIVER_AXES_ID_SEQ; CREATE TABLE river_axes( OGR_FID NUMBER(38), GEOM MDSYS.SDO_GEOMETRY, river_id NUMBER(38), kind NUMBER(38) DEFAULT 0 NOT NULL, ID NUMBER PRIMARY KEY NOT NULL ); --Extent: (2539488.036000, 5450928.892000) - (2575486.407000, 5507352.839000) INSERT INTO USER_SDO_GEOM_METADATA VALUES ('river_axes', 'GEOM', MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',2539488.036000,2575486.407000,0.001),MDSYS.SDO_DIM_ELEMENT('Y',5450928.892000,5507352.839000,0.001),MDSYS.SDO_DIM_ELEMENT('Z',-100000,100000,0.002)), 31466); CREATE OR REPLACE TRIGGER river_axes_trigger BEFORE INSERT ON river_axes FOR each ROW BEGIN SELECT RIVER_AXES_ID_SEQ.nextval INTO :new.id FROM dual; END; / --/opt/gdal-1.8.0/bin/ogr2ogr -f OCI OCI:flys3/flys3@localhost achse.shp -sql 'SELECT 1 AS river_id,0 as kind from achse' -nln river_axes -append --CREATE INDEX river_axes_spatial_idx ON river_axes(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=LINE'); --Geodaesie/Querprofile/QP-Spuren/qps.shp CREATE SEQUENCE CROSS_SECTION_TRACKS_ID_SEQ; CREATE TABLE cross_section_tracks ( OGR_FID NUMBER(38), GEOM MDSYS.SDO_GEOMETRY, river_id NUMBER(38), km NUMBER(14,12) NOT NULL, z NUMBER(18,5) DEFAULT 0 NOT NULL, ID NUMBER PRIMARY KEY NOT NULL ); --Extent: (2539289.724000, 5450852.896743) - (2576589.878311, 5507289.656000) INSERT INTO USER_SDO_GEOM_METADATA VALUES ('cross_section_tracks', 'GEOM', MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',2539289.724000,2576589.878311,0.001),MDSYS.SDO_DIM_ELEMENT('Y',5450852.896743,5507289.656000,0.001),MDSYS.SDO_DIM_ELEMENT('Z',-100000,100000,0.002)), 31466); CREATE OR REPLACE TRIGGER cross_section_tracks_trigger BEFORE INSERT ON cross_section_tracks FOR each ROW BEGIN SELECT CROSS_SECTION_TRACKS_ID_SEQ.nextval INTO :new.id FROM dual; END; / -- /opt/gdal-1.8.0/bin/ogr2ogr -f OCI OCI:flys3/flys3@localhost qps.shp -sql 'SELECT 1 AS river_id,KILOMETER as km, ELEVATION as z from qps' -nln cross_section_tracks -append --CREATE INDEX CrossSectionTracks_spatial_idx ON cross_section_tracks(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=LINE'); --Hydrologie/HW-Schutzanlagen/hws.shp CREATE SEQUENCE HWS_ID_SEQ; CREATE TABLE hws( OGR_FID NUMBER(38), GEOM MDSYS.SDO_GEOMETRY, river_id NUMBER(38), hws_facility VARCHAR2(40), type VARCHAR2(254), ID NUMBER PRIMARY KEY NOT NULL ); --Extent: (2539778.101933, 5456638.161347) - (2567463.841704, 5500605.745332) INSERT INTO USER_SDO_GEOM_METADATA VALUES ('hws', 'GEOM', MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',2539778.101933,2567463.841704,0.001),MDSYS.SDO_DIM_ELEMENT('Y',5456638.161347,5500605.745332,0.001),MDSYS.SDO_DIM_ELEMENT('Z',-100000,100000,0.002)), 31466); CREATE OR REPLACE TRIGGER hws_trigger BEFORE INSERT ON hws FOR each ROW BEGIN SELECT HWS_ID_SEQ.nextval INTO :new.id FROM dual; END; / --/opt/gdal-1.8.0/bin/ogr2ogr -f OCI OCI:flys3/flys3@localhost hws.shp -sql 'SELECT 1 AS river_id,HWS_ANLAGE as hws_facility, TYP as type from HWS' -nln hws -append --CREATE INDEX hws_spatial_idx ON hws(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=LINE'); -- Hydrologie/Hydr. Grenzen/talaue.shp CREATE SEQUENCE FLOODPLAIN_ID_SEQ; CREATE TABLE floodplain( OGR_FID NUMBER(38), GEOM MDSYS.SDO_GEOMETRY, river_id NUMBER(38), ID NUMBER PRIMARY KEY NOT NULL ); --Extent: (2539343.776823, 5451397.340027) - (2576021.009478, 5507230.640000) INSERT INTO USER_SDO_GEOM_METADATA VALUES ('floodplain', 'GEOM', MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',2539343.776823,2576021.009478,0.001),MDSYS.SDO_DIM_ELEMENT('Y',5451397.340027,5507230.640000,0.001),MDSYS.SDO_DIM_ELEMENT('Z',-100000,100000,0.002)), 31466); CREATE OR REPLACE TRIGGER floodplain_trigger BEFORE INSERT ON floodplain FOR each ROW BEGIN SELECT FLOODPLAIN_ID_SEQ.nextval INTO :new.id FROM dual; END; / --/opt/gdal-1.8.0/bin/ogr2ogr -f OCI OCI:flys3/flys3@localhost talaue.shp -sql 'SELECT 1 AS river_id from talaue' -nln floodplain -append --CREATE INDEX floodplain_spatial_idx ON floodplain(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=POLYGON');