annotate flys-backend/doc/schema/oracle-spatial.sql @ 1246:e334314e8eb2

Added schema buildings. flys-backend/trunk@2724 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Bjoern Schilberg <bjoern@intevation.de>
date Wed, 14 Sep 2011 07:20:26 +0000
parents 0414181b0859
children 6c6c5500d72d
rev   line source
1244
281f38fc6c3e Initial oracle schema.
Bjoern Schilberg <bjoern@intevation.de>
parents:
diff changeset
1 BEGIN;
281f38fc6c3e Initial oracle schema.
Bjoern Schilberg <bjoern@intevation.de>
parents:
diff changeset
2
281f38fc6c3e Initial oracle schema.
Bjoern Schilberg <bjoern@intevation.de>
parents:
diff changeset
3
281f38fc6c3e Initial oracle schema.
Bjoern Schilberg <bjoern@intevation.de>
parents:
diff changeset
4 -- Hydrologie/Einzugsgebiete/EZG.shp
281f38fc6c3e Initial oracle schema.
Bjoern Schilberg <bjoern@intevation.de>
parents:
diff changeset
5
281f38fc6c3e Initial oracle schema.
Bjoern Schilberg <bjoern@intevation.de>
parents:
diff changeset
6 CREATE SEQUENCE CATCHMENT_ID_SEQ;
281f38fc6c3e Initial oracle schema.
Bjoern Schilberg <bjoern@intevation.de>
parents:
diff changeset
7 CREATE TABLE catchment(
281f38fc6c3e Initial oracle schema.
Bjoern Schilberg <bjoern@intevation.de>
parents:
diff changeset
8 OGR_FID NUMBER(38),
281f38fc6c3e Initial oracle schema.
Bjoern Schilberg <bjoern@intevation.de>
parents:
diff changeset
9 GEOM MDSYS.SDO_GEOMETRY,
281f38fc6c3e Initial oracle schema.
Bjoern Schilberg <bjoern@intevation.de>
parents:
diff changeset
10 river_id NUMBER(38),
281f38fc6c3e Initial oracle schema.
Bjoern Schilberg <bjoern@intevation.de>
parents:
diff changeset
11 area NUMBER(19,5),
281f38fc6c3e Initial oracle schema.
Bjoern Schilberg <bjoern@intevation.de>
parents:
diff changeset
12 name VARCHAR2(80),
281f38fc6c3e Initial oracle schema.
Bjoern Schilberg <bjoern@intevation.de>
parents:
diff changeset
13 ID NUMBER PRIMARY KEY NOT NULL
281f38fc6c3e Initial oracle schema.
Bjoern Schilberg <bjoern@intevation.de>
parents:
diff changeset
14 );
281f38fc6c3e Initial oracle schema.
Bjoern Schilberg <bjoern@intevation.de>
parents:
diff changeset
15 --EXTENT 2520667.897954 5376316.575645 2634771.191263 5508288.005707
281f38fc6c3e Initial oracle schema.
Bjoern Schilberg <bjoern@intevation.de>
parents:
diff changeset
16 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);
281f38fc6c3e Initial oracle schema.
Bjoern Schilberg <bjoern@intevation.de>
parents:
diff changeset
17
281f38fc6c3e Initial oracle schema.
Bjoern Schilberg <bjoern@intevation.de>
parents:
diff changeset
18 CREATE TRIGGER catchment_trigger BEFORE INSERT ON catchment FOR each ROW
281f38fc6c3e Initial oracle schema.
Bjoern Schilberg <bjoern@intevation.de>
parents:
diff changeset
19 BEGIN
281f38fc6c3e Initial oracle schema.
Bjoern Schilberg <bjoern@intevation.de>
parents:
diff changeset
20 SELECT CATCHMENT_ID_SEQ.nextval INTO :new.id FROM dual;
281f38fc6c3e Initial oracle schema.
Bjoern Schilberg <bjoern@intevation.de>
parents:
diff changeset
21 END;
281f38fc6c3e Initial oracle schema.
Bjoern Schilberg <bjoern@intevation.de>
parents:
diff changeset
22 /
281f38fc6c3e Initial oracle schema.
Bjoern Schilberg <bjoern@intevation.de>
parents:
diff changeset
23 --/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
281f38fc6c3e Initial oracle schema.
Bjoern Schilberg <bjoern@intevation.de>
parents:
diff changeset
24 CREATE INDEX catchment_spatial_idx ON catchment(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=polygon');
281f38fc6c3e Initial oracle schema.
Bjoern Schilberg <bjoern@intevation.de>
parents:
diff changeset
25
281f38fc6c3e Initial oracle schema.
Bjoern Schilberg <bjoern@intevation.de>
parents:
diff changeset
26 -- Geodaesie/Flussachse+km/km.shp
1245
0414181b0859 Fixed table river_axes_km.
Bjoern Schilberg <bjoern@intevation.de>
parents: 1244
diff changeset
27 CREATE SEQUENCE RIVER_AXES_KM_ID_SEQ;
0414181b0859 Fixed table river_axes_km.
Bjoern Schilberg <bjoern@intevation.de>
parents: 1244
diff changeset
28 CREATE TABLE river_axes_km(
1244
281f38fc6c3e Initial oracle schema.
Bjoern Schilberg <bjoern@intevation.de>
parents:
diff changeset
29 OGR_FID NUMBER(38),
281f38fc6c3e Initial oracle schema.
Bjoern Schilberg <bjoern@intevation.de>
parents:
diff changeset
30 GEOM MDSYS.SDO_GEOMETRY,
281f38fc6c3e Initial oracle schema.
Bjoern Schilberg <bjoern@intevation.de>
parents:
diff changeset
31 river_id NUMBER(38),
281f38fc6c3e Initial oracle schema.
Bjoern Schilberg <bjoern@intevation.de>
parents:
diff changeset
32 km NUMBER(6,3),
281f38fc6c3e Initial oracle schema.
Bjoern Schilberg <bjoern@intevation.de>
parents:
diff changeset
33 ID NUMBER PRIMARY KEY NOT NULL
281f38fc6c3e Initial oracle schema.
Bjoern Schilberg <bjoern@intevation.de>
parents:
diff changeset
34 );
281f38fc6c3e Initial oracle schema.
Bjoern Schilberg <bjoern@intevation.de>
parents:
diff changeset
35 --Extent: (2539489.068000, 5450953.000500) - (2575482.527500, 5507278.634500)
1245
0414181b0859 Fixed table river_axes_km.
Bjoern Schilberg <bjoern@intevation.de>
parents: 1244
diff changeset
36 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);
0414181b0859 Fixed table river_axes_km.
Bjoern Schilberg <bjoern@intevation.de>
parents: 1244
diff changeset
37 CREATE OR REPLACE TRIGGER river_axes_km_trigger BEFORE INSERT ON river_axes_km FOR each ROW
1244
281f38fc6c3e Initial oracle schema.
Bjoern Schilberg <bjoern@intevation.de>
parents:
diff changeset
38 BEGIN
1245
0414181b0859 Fixed table river_axes_km.
Bjoern Schilberg <bjoern@intevation.de>
parents: 1244
diff changeset
39 SELECT river_axes_km_ID_SEQ.nextval INTO :new.id FROM dual;
1244
281f38fc6c3e Initial oracle schema.
Bjoern Schilberg <bjoern@intevation.de>
parents:
diff changeset
40 END;
281f38fc6c3e Initial oracle schema.
Bjoern Schilberg <bjoern@intevation.de>
parents:
diff changeset
41 /
1245
0414181b0859 Fixed table river_axes_km.
Bjoern Schilberg <bjoern@intevation.de>
parents: 1244
diff changeset
42 --/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
0414181b0859 Fixed table river_axes_km.
Bjoern Schilberg <bjoern@intevation.de>
parents: 1244
diff changeset
43 CREATE INDEX river_axes_km_spatial_idx ON river_axes_km(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=point');
1244
281f38fc6c3e Initial oracle schema.
Bjoern Schilberg <bjoern@intevation.de>
parents:
diff changeset
44
1246
e334314e8eb2 Added schema buildings.
Bjoern Schilberg <bjoern@intevation.de>
parents: 1245
diff changeset
45 -- Geodaesie/Bauwerke/Wehre.shp
e334314e8eb2 Added schema buildings.
Bjoern Schilberg <bjoern@intevation.de>
parents: 1245
diff changeset
46 CREATE SEQUENCE BUILDINGS_ID_SEQ;
e334314e8eb2 Added schema buildings.
Bjoern Schilberg <bjoern@intevation.de>
parents: 1245
diff changeset
47 CREATE TABLE buildings(
e334314e8eb2 Added schema buildings.
Bjoern Schilberg <bjoern@intevation.de>
parents: 1245
diff changeset
48 OGR_FID NUMBER(38),
e334314e8eb2 Added schema buildings.
Bjoern Schilberg <bjoern@intevation.de>
parents: 1245
diff changeset
49 GEOM MDSYS.SDO_GEOMETRY,
e334314e8eb2 Added schema buildings.
Bjoern Schilberg <bjoern@intevation.de>
parents: 1245
diff changeset
50 river_id NUMBER(38),
e334314e8eb2 Added schema buildings.
Bjoern Schilberg <bjoern@intevation.de>
parents: 1245
diff changeset
51 name VARCHAR2(50),
e334314e8eb2 Added schema buildings.
Bjoern Schilberg <bjoern@intevation.de>
parents: 1245
diff changeset
52 ID NUMBER PRIMARY KEY NOT NULL
e334314e8eb2 Added schema buildings.
Bjoern Schilberg <bjoern@intevation.de>
parents: 1245
diff changeset
53 );
e334314e8eb2 Added schema buildings.
Bjoern Schilberg <bjoern@intevation.de>
parents: 1245
diff changeset
54 --Extent: (2540544.253718, 5456266.217464) - (2567747.834199, 5502557.982120)
e334314e8eb2 Added schema buildings.
Bjoern Schilberg <bjoern@intevation.de>
parents: 1245
diff changeset
55 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);
e334314e8eb2 Added schema buildings.
Bjoern Schilberg <bjoern@intevation.de>
parents: 1245
diff changeset
56 CREATE OR REPLACE TRIGGER buildings_trigger BEFORE INSERT ON buildings FOR each ROW
e334314e8eb2 Added schema buildings.
Bjoern Schilberg <bjoern@intevation.de>
parents: 1245
diff changeset
57 BEGIN
e334314e8eb2 Added schema buildings.
Bjoern Schilberg <bjoern@intevation.de>
parents: 1245
diff changeset
58 SELECT BUILDINGS_ID_SEQ.nextval INTO :new.id FROM dual;
e334314e8eb2 Added schema buildings.
Bjoern Schilberg <bjoern@intevation.de>
parents: 1245
diff changeset
59 END;
e334314e8eb2 Added schema buildings.
Bjoern Schilberg <bjoern@intevation.de>
parents: 1245
diff changeset
60 /
e334314e8eb2 Added schema buildings.
Bjoern Schilberg <bjoern@intevation.de>
parents: 1245
diff changeset
61 --/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
e334314e8eb2 Added schema buildings.
Bjoern Schilberg <bjoern@intevation.de>
parents: 1245
diff changeset
62 CREATE INDEX buildings_spatial_idx ON buildings(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=LINE');
e334314e8eb2 Added schema buildings.
Bjoern Schilberg <bjoern@intevation.de>
parents: 1245
diff changeset
63
e334314e8eb2 Added schema buildings.
Bjoern Schilberg <bjoern@intevation.de>
parents: 1245
diff changeset
64
1244
281f38fc6c3e Initial oracle schema.
Bjoern Schilberg <bjoern@intevation.de>
parents:
diff changeset
65 END;
1246
e334314e8eb2 Added schema buildings.
Bjoern Schilberg <bjoern@intevation.de>
parents: 1245
diff changeset
66

http://dive4elements.wald.intevation.org