comparison flys-backend/doc/schema/oracle-spatial.sql @ 1244:281f38fc6c3e

Initial oracle schema. flys-backend/trunk@2722 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Bjoern Schilberg <bjoern@intevation.de>
date Tue, 13 Sep 2011 20:06:48 +0000
parents
children 0414181b0859
comparison
equal deleted inserted replaced
1243:3ebc0a7d6793 1244:281f38fc6c3e
1 BEGIN;
2
3
4 -- Hydrologie/Einzugsgebiete/EZG.shp
5
6 CREATE SEQUENCE CATCHMENT_ID_SEQ;
7 CREATE TABLE catchment(
8 OGR_FID NUMBER(38),
9 GEOM MDSYS.SDO_GEOMETRY,
10 river_id NUMBER(38),
11 area NUMBER(19,5),
12 name VARCHAR2(80),
13 ID NUMBER PRIMARY KEY NOT NULL
14 );
15 --EXTENT 2520667.897954 5376316.575645 2634771.191263 5508288.005707
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);
17
18 CREATE TRIGGER catchment_trigger BEFORE INSERT ON catchment FOR each ROW
19 BEGIN
20 SELECT CATCHMENT_ID_SEQ.nextval INTO :new.id FROM dual;
21 END;
22 /
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
24 CREATE INDEX catchment_spatial_idx ON catchment(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=polygon');
25
26 -- FIXME
27 -- Geodaesie/Flussachse+km/km.shp
28 CREATE SEQUENCE test_ID_SEQ;
29 CREATE TABLE test(
30 OGR_FID NUMBER(38),
31 GEOM MDSYS.SDO_GEOMETRY,
32 river_id NUMBER(38),
33 km NUMBER(6,3),
34 ID NUMBER PRIMARY KEY NOT NULL
35 );
36 --Extent: (2539489.068000, 5450953.000500) - (2575482.527500, 5507278.634500)
37 INSERT INTO USER_SDO_GEOM_METADATA VALUES ('test', 'GEOM', MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',2539490.068000,2575482.527500,0.001),MDSYS.SDO_DIM_ELEMENT('Y',5450953.000500,5507278.634500,0.001)), 31466);
38 CREATE TRIGGER test_trigger BEFORE INSERT ON test FOR each ROW
39 BEGIN
40 SELECT TEST_ID_SEQ.nextval INTO :new.id FROM dual;
41 END;
42 /
43 --/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 test -nlt POINT -append
44 CREATE INDEX test_spatial_idx ON test(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=point');
45 --CREATE INDEX test_spatial_idx ON test(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('sdo_indx_dims=2,LAYER_GTYPE=point');
46
47 END;

http://dive4elements.wald.intevation.org