comparison flys-backend/doc/schema/oracle-spatial.sql @ 2338:e69ef36290ae

Harmonized Extent for Saar and Mosel. Some cleanups. flys-backend/trunk@2809 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Bjoern Schilberg <bjoern@intevation.de>
date Thu, 22 Sep 2011 12:10:08 +0000
parents e1fb4a1e0b4a
children b28ab244a77d
comparison
equal deleted inserted replaced
2337:52d712cd2384 2338:e69ef36290ae
1 -- Hydrologie/Einzugsgebiete/EZG.shp 1 -- Hydrologie/Einzugsgebiete/EZG.shp
2
3 CREATE SEQUENCE CATCHMENT_ID_SEQ; 2 CREATE SEQUENCE CATCHMENT_ID_SEQ;
4 CREATE TABLE catchment( 3 CREATE TABLE catchment(
5 OGR_FID NUMBER(38), 4 OGR_FID NUMBER(38),
6 GEOM MDSYS.SDO_GEOMETRY, 5 GEOM MDSYS.SDO_GEOMETRY,
7 river_id NUMBER(38), 6 river_id NUMBER(38),
8 area NUMBER(19,5), 7 area NUMBER(19,5),
9 name VARCHAR2(255), 8 name VARCHAR2(255),
10 ID NUMBER PRIMARY KEY NOT NULL 9 ID NUMBER PRIMARY KEY NOT NULL
11 ); 10 );
12 --EXTENT 2520667.897954 5376316.575645 2634771.191263 5508288.005707 11 INSERT INTO USER_SDO_GEOM_METADATA VALUES ('CATCHMENT', 'GEOM', MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',2457864.326387,2634771.191263,0.001),MDSYS.SDO_DIM_ELEMENT('Y',5297459.306295,5586961.449130,0.001),MDSYS.SDO_DIM_ELEMENT('Z',-100000,100000,0.002)), 31466);
13 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);
14 12
15 CREATE TRIGGER catchment_trigger BEFORE INSERT ON catchment FOR each ROW 13 CREATE TRIGGER catchment_trigger BEFORE INSERT ON catchment FOR each ROW
16 BEGIN 14 BEGIN
17 SELECT CATCHMENT_ID_SEQ.nextval INTO :new.id FROM dual; 15 SELECT CATCHMENT_ID_SEQ.nextval INTO :new.id FROM dual;
18 END; 16 END;
19 / 17 /
20 --/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
21 --CREATE INDEX catchment_spatial_idx ON catchment(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=polygon'); 18 --CREATE INDEX catchment_spatial_idx ON catchment(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=polygon');
22 19
23 -- Geodaesie/Flussachse+km/km.shp 20 -- Geodaesie/Flussachse+km/km.shp
24 CREATE SEQUENCE RIVER_AXES_KM_ID_SEQ; 21 CREATE SEQUENCE RIVER_AXES_KM_ID_SEQ;
25 CREATE TABLE river_axes_km( 22 CREATE TABLE river_axes_km(
27 GEOM MDSYS.SDO_GEOMETRY, 24 GEOM MDSYS.SDO_GEOMETRY,
28 river_id NUMBER(38), 25 river_id NUMBER(38),
29 km NUMBER(6,3), 26 km NUMBER(6,3),
30 ID NUMBER PRIMARY KEY NOT NULL 27 ID NUMBER PRIMARY KEY NOT NULL
31 ); 28 );
32 --Extent: (2539489.068000, 5450953.000500) - (2575482.527500, 5507278.634500) 29 INSERT INTO USER_SDO_GEOM_METADATA VALUES ('river_axes_km', 'GEOM', MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',2457864.326387,2634771.191263,0.001),MDSYS.SDO_DIM_ELEMENT('Y',5297459.306295,5586961.449130,0.001),MDSYS.SDO_DIM_ELEMENT('Z',-100000,100000,0.002)), 31466);
33 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);
34 CREATE OR REPLACE TRIGGER river_axes_km_trigger BEFORE INSERT ON river_axes_km FOR each ROW 30 CREATE OR REPLACE TRIGGER river_axes_km_trigger BEFORE INSERT ON river_axes_km FOR each ROW
35 BEGIN 31 BEGIN
36 SELECT river_axes_km_ID_SEQ.nextval INTO :new.id FROM dual; 32 SELECT river_axes_km_ID_SEQ.nextval INTO :new.id FROM dual;
37 END; 33 END;
38 / 34 /
39 --/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
40 --CREATE INDEX river_axes_km_spatial_idx ON river_axes_km(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=point'); 35 --CREATE INDEX river_axes_km_spatial_idx ON river_axes_km(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=point');
41 36
42 -- Geodaesie/Bauwerke/Wehre.shp 37 -- Geodaesie/Bauwerke/Wehre.shp
43 CREATE SEQUENCE BUILDINGS_ID_SEQ; 38 CREATE SEQUENCE BUILDINGS_ID_SEQ;
44 CREATE TABLE buildings( 39 CREATE TABLE buildings(
46 GEOM MDSYS.SDO_GEOMETRY, 41 GEOM MDSYS.SDO_GEOMETRY,
47 river_id NUMBER(38), 42 river_id NUMBER(38),
48 name VARCHAR2(255), 43 name VARCHAR2(255),
49 ID NUMBER PRIMARY KEY NOT NULL 44 ID NUMBER PRIMARY KEY NOT NULL
50 ); 45 );
51 --Extent: (2540544.253718, 5456266.217464) - (2567747.834199, 5502557.982120) 46 INSERT INTO USER_SDO_GEOM_METADATA VALUES ('buildings', 'GEOM', MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',2457864.326387,2634771.191263,0.001),MDSYS.SDO_DIM_ELEMENT('Y',5297459.306295,5586961.449130,0.001),MDSYS.SDO_DIM_ELEMENT('Z',-100000,100000,0.002)), 31466);
52 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);
53 CREATE OR REPLACE TRIGGER buildings_trigger BEFORE INSERT ON buildings FOR each ROW 47 CREATE OR REPLACE TRIGGER buildings_trigger BEFORE INSERT ON buildings FOR each ROW
54 BEGIN 48 BEGIN
55 SELECT BUILDINGS_ID_SEQ.nextval INTO :new.id FROM dual; 49 SELECT BUILDINGS_ID_SEQ.nextval INTO :new.id FROM dual;
56 END; 50 END;
57 / 51 /
58 --/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
59 --CREATE INDEX buildings_spatial_idx ON buildings(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=LINE'); 52 --CREATE INDEX buildings_spatial_idx ON buildings(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=LINE');
60 53
61 -- Geodaesie/Festpunkte/Festpunkte.shp 54 -- Geodaesie/Festpunkte/Festpunkte.shp
62 CREATE SEQUENCE FIXPOINTS_ID_SEQ; 55 CREATE SEQUENCE FIXPOINTS_ID_SEQ;
63 CREATE TABLE fixpoints ( 56 CREATE TABLE fixpoints (
69 km NUMBER(38,11) NOT NULL, 62 km NUMBER(38,11) NOT NULL,
70 HPGP VARCHAR2(255), 63 HPGP VARCHAR2(255),
71 ID NUMBER PRIMARY KEY NOT NULL 64 ID NUMBER PRIMARY KEY NOT NULL
72 ); 65 );
73 --Extent: (2539388.036000, 5450896.688000) - (2575586.296000, 5507370.606000) 66 --Extent: (2539388.036000, 5450896.688000) - (2575586.296000, 5507370.606000)
74 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); 67 INSERT INTO USER_SDO_GEOM_METADATA VALUES ('fixpoints', 'GEOM', MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',2457864.326387,2634771.191263,0.001),MDSYS.SDO_DIM_ELEMENT('Y',5297459.306295,5586961.449130,0.001),MDSYS.SDO_DIM_ELEMENT('Z',-100000,100000,0.002)), 31466);
75 CREATE OR REPLACE TRIGGER fixpoints_trigger BEFORE INSERT ON fixpoints FOR each ROW 68 CREATE OR REPLACE TRIGGER fixpoints_trigger BEFORE INSERT ON fixpoints FOR each ROW
76 BEGIN 69 BEGIN
77 SELECT FIXPOINTS_ID_SEQ.nextval INTO :new.id FROM dual; 70 SELECT FIXPOINTS_ID_SEQ.nextval INTO :new.id FROM dual;
78 END; 71 END;
79 / 72 /
80 --/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
81 --CREATE INDEX fixpoints_spatial_idx ON fixpoints(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=POINT'); 73 --CREATE INDEX fixpoints_spatial_idx ON fixpoints(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=POINT');
82 74
83 -- Geodaesie/Flussachse+km/achse 75 -- Geodaesie/Flussachse+km/achse
84 CREATE SEQUENCE RIVER_AXES_ID_SEQ; 76 CREATE SEQUENCE RIVER_AXES_ID_SEQ;
85 CREATE TABLE river_axes( 77 CREATE TABLE river_axes(
87 GEOM MDSYS.SDO_GEOMETRY, 79 GEOM MDSYS.SDO_GEOMETRY,
88 river_id NUMBER(38), 80 river_id NUMBER(38),
89 kind NUMBER(38) DEFAULT 0 NOT NULL, 81 kind NUMBER(38) DEFAULT 0 NOT NULL,
90 ID NUMBER PRIMARY KEY NOT NULL 82 ID NUMBER PRIMARY KEY NOT NULL
91 ); 83 );
92 --Extent: (2539488.036000, 5450928.892000) - (2575486.407000, 5507352.839000) 84 INSERT INTO USER_SDO_GEOM_METADATA VALUES ('river_axes', 'GEOM', MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',2457864.326387,2634771.191263,0.001),MDSYS.SDO_DIM_ELEMENT('Y',5297459.306295,5586961.449130,0.001),MDSYS.SDO_DIM_ELEMENT('Z',-100000,100000,0.002)), 31466);
93 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);
94 CREATE OR REPLACE TRIGGER river_axes_trigger BEFORE INSERT ON river_axes FOR each ROW 85 CREATE OR REPLACE TRIGGER river_axes_trigger BEFORE INSERT ON river_axes FOR each ROW
95 BEGIN 86 BEGIN
96 SELECT RIVER_AXES_ID_SEQ.nextval INTO :new.id FROM dual; 87 SELECT RIVER_AXES_ID_SEQ.nextval INTO :new.id FROM dual;
97 END; 88 END;
98 / 89 /
99 --/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
100 --CREATE INDEX river_axes_spatial_idx ON river_axes(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=LINE'); 90 --CREATE INDEX river_axes_spatial_idx ON river_axes(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=LINE');
101 91
102 --Geodaesie/Querprofile/QP-Spuren/qps.shp 92 --Geodaesie/Querprofile/QP-Spuren/qps.shp
103 CREATE SEQUENCE CROSS_SECTION_TRACKS_ID_SEQ; 93 CREATE SEQUENCE CROSS_SECTION_TRACKS_ID_SEQ;
104 CREATE TABLE cross_section_tracks ( 94 CREATE TABLE cross_section_tracks (
105 OGR_FID NUMBER(38), 95 OGR_FID NUMBER(38),
106 GEOM MDSYS.SDO_GEOMETRY, 96 GEOM MDSYS.SDO_GEOMETRY,
107 river_id NUMBER(38), 97 river_id NUMBER(38),
108 km NUMBER(38,12) NOT NULL, 98 km NUMBER(38,12) NOT NULL,
109 z NUMBER(18,5) DEFAULT 0 NOT NULL, 99 z NUMBER(38,12) DEFAULT 0 NOT NULL,
110 ID NUMBER PRIMARY KEY NOT NULL 100 ID NUMBER PRIMARY KEY NOT NULL
111 ); 101 );
112 --Extent: (2539289.724000, 5450852.896743) - (2576589.878311, 5507289.656000) 102 INSERT INTO USER_SDO_GEOM_METADATA VALUES ('cross_section_tracks', 'GEOM', MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',2457864.326387,2634771.191263,0.001),MDSYS.SDO_DIM_ELEMENT('Y',5297459.306295,5586961.449130,0.001),MDSYS.SDO_DIM_ELEMENT('Z',-100000,100000,0.002)), 31466);
113 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);
114 CREATE OR REPLACE TRIGGER cross_section_tracks_trigger BEFORE INSERT ON cross_section_tracks FOR each ROW 103 CREATE OR REPLACE TRIGGER cross_section_tracks_trigger BEFORE INSERT ON cross_section_tracks FOR each ROW
115 BEGIN 104 BEGIN
116 SELECT CROSS_SECTION_TRACKS_ID_SEQ.nextval INTO :new.id FROM dual; 105 SELECT CROSS_SECTION_TRACKS_ID_SEQ.nextval INTO :new.id FROM dual;
117 END; 106 END;
118 / 107 /
119 -- /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
120 --CREATE INDEX CrossSectionTracks_spatial_idx ON cross_section_tracks(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=LINE'); 108 --CREATE INDEX CrossSectionTracks_spatial_idx ON cross_section_tracks(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=LINE');
121 109
122 --Hydrologie/HW-Schutzanlagen/hws.shp 110 --Hydrologie/HW-Schutzanlagen/hws.shp
123 CREATE SEQUENCE HWS_ID_SEQ; 111 CREATE SEQUENCE HWS_ID_SEQ;
124 CREATE TABLE hws( 112 CREATE TABLE hws(
127 river_id NUMBER(38), 115 river_id NUMBER(38),
128 hws_facility VARCHAR2(255), 116 hws_facility VARCHAR2(255),
129 type VARCHAR2(255), 117 type VARCHAR2(255),
130 ID NUMBER PRIMARY KEY NOT NULL 118 ID NUMBER PRIMARY KEY NOT NULL
131 ); 119 );
132 --Extent: (2539778.101933, 5456638.161347) - (2567463.841704, 5500605.745332) 120 INSERT INTO USER_SDO_GEOM_METADATA VALUES ('hws', 'GEOM', MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',2457864.326387,2634771.191263,0.001),MDSYS.SDO_DIM_ELEMENT('Y',5297459.306295,5586961.449130,0.001),MDSYS.SDO_DIM_ELEMENT('Z',-100000,100000,0.002)), 31466);
133 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);
134 CREATE OR REPLACE TRIGGER hws_trigger BEFORE INSERT ON hws FOR each ROW 121 CREATE OR REPLACE TRIGGER hws_trigger BEFORE INSERT ON hws FOR each ROW
135 BEGIN 122 BEGIN
136 SELECT HWS_ID_SEQ.nextval INTO :new.id FROM dual; 123 SELECT HWS_ID_SEQ.nextval INTO :new.id FROM dual;
137 END; 124 END;
138 / 125 /
139 --/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
140 --CREATE INDEX hws_spatial_idx ON hws(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=LINE'); 126 --CREATE INDEX hws_spatial_idx ON hws(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=LINE');
141 127
142 -- Hydrologie/Hydr. Grenzen/talaue.shp 128 -- Hydrologie/Hydr. Grenzen/talaue.shp
143 CREATE SEQUENCE FLOODPLAIN_ID_SEQ; 129 CREATE SEQUENCE FLOODPLAIN_ID_SEQ;
144 CREATE TABLE floodplain( 130 CREATE TABLE floodplain(
145 OGR_FID NUMBER(38), 131 OGR_FID NUMBER(38),
146 GEOM MDSYS.SDO_GEOMETRY, 132 GEOM MDSYS.SDO_GEOMETRY,
147 river_id NUMBER(38), 133 river_id NUMBER(38),
148 ID NUMBER PRIMARY KEY NOT NULL 134 ID NUMBER PRIMARY KEY NOT NULL
149 ); 135 );
150 --Extent: (2539343.776823, 5451397.340027) - (2576021.009478, 5507230.640000) 136 INSERT INTO USER_SDO_GEOM_METADATA VALUES ('floodplain', 'GEOM', MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',2457864.326387,2634771.191263,0.001),MDSYS.SDO_DIM_ELEMENT('Y',5297459.306295,5586961.449130,0.001),MDSYS.SDO_DIM_ELEMENT('Z',-100000,100000,0.002)), 31466);
151 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);
152 CREATE OR REPLACE TRIGGER floodplain_trigger BEFORE INSERT ON floodplain FOR each ROW 137 CREATE OR REPLACE TRIGGER floodplain_trigger BEFORE INSERT ON floodplain FOR each ROW
153 BEGIN 138 BEGIN
154 SELECT FLOODPLAIN_ID_SEQ.nextval INTO :new.id FROM dual; 139 SELECT FLOODPLAIN_ID_SEQ.nextval INTO :new.id FROM dual;
155 END; 140 END;
156 / 141 /
157 --/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
158 --CREATE INDEX floodplain_spatial_idx ON floodplain(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=POLYGON'); 142 --CREATE INDEX floodplain_spatial_idx ON floodplain(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=POLYGON');

http://dive4elements.wald.intevation.org