Ticket #21273: sample_data.sql

File sample_data.sql, 6.3 KB (added by vinhussey, 11 years ago)

sample_data.sql

Line 
1-- just one set of titles
2set pagesize 10000;
3
4-- drop table
5DROP TABLE SDO_TEST;
6
7-- check srid - should return Irish Transverse Mercator
8select * from MDSYS.CS_SRS where srid = 82086;
9
10-- create test table
11CREATE TABLE SDO_TEST (ID NUMBER PRIMARY KEY, NAME VARCHAR2(100), GEOM SDO_GEOMETRY);
12
13-- create an index in the metadata table
14INSERT INTO USER_SDO_GEOM_METADATA
15 (TABLE_NAME, COLUMN_NAME, DIMINFO, SRID)
16 VALUES ('SDO_TEST','GEOM',
17 SDO_DIM_ARRAY(
18 SDO_DIM_ELEMENT('X', -8048350, 8448349.95, .005),
19 SDO_DIM_ELEMENT('Y', -15680949, 4321303.19, .005)
20 ),
21 82086);
22
23-- create index for table
24CREATE INDEX SDO_TEST_IDX ON SDO_TEST(GEOM) INDEXTYPE IS MDSYS.SPATIAL_INDEX;
25
26-- CREATE TYPE sdo_geometry AS OBJECT (
27-- SDO_GTYPE NUMBER,
28-- SDO_SRID NUMBER,
29-- SDO_POINT SDO_POINT_TYPE,
30-- SDO_ELEM_INFO SDO_ELEM_INFO_ARRAY,
31-- SDO_ORDINATES SDO_ORDINATE_ARRAY);
32
33-- CREATE TYPE sdo_point_type AS OBJECT (
34-- X NUMBER,
35-- Y NUMBER,
36-- Z NUMBER);
37-- CREATE TYPE sdo_elem_info_array AS VARRAY (1048576) of NUMBER;
38-- CREATE TYPE sdo_ordinate_array AS VARRAY (1048576) of NUMBER;
39
40
41
42
43-- add data
44-- tried SDO_GEOMETRY(wkb BLOB, srid NUMBER DEFAULT NULL); - didn't work
45-- point
46INSERT INTO SDO_TEST VALUES (
47 1, 'point', SDO_GEOMETRY(
48 -- WKT
49 -- 'POINT(200000 200000)', 82086
50 -- BLOB: SDO_GTYPE, SDO_SRID, SDO_POINT_TYPE, SDO_ELEM_INFO, SDO_ORDINATES
51 2001, 82086, SDO_POINT_TYPE(200000, 200000, NULL), NULL, NULL
52 )
53);
54
55-- line segment
56INSERT INTO SDO_TEST VALUES (
57 2, 'linestring', SDO_GEOMETRY(
58 -- WKT
59 -- 'LINESTRING(200000 200000, 220000 200000, 220000 220000)', 82086
60 -- BLOB: SDO_GTYPE, SDO_SRID, SDO_POINT_TYPE, SDO_ELEM_INFO, SDO_ORDINATE
61 2002, 82086, SDO_POINT_TYPE(NULL,NULL,NULL),
62 SDO_ELEM_INFO_ARRAY(1,2,1),
63 SDO_ORDINATE_ARRAY(200000, 200000, 220000, 200000, 220000, 220000)
64 )
65);
66
67-- polygon
68INSERT INTO SDO_TEST VALUES (
69 3, 'polygon', SDO_GEOMETRY(
70 -- WKT
71 -- 'POLYGON((200000 200000, 220000 200000, 220000 220000, 200000 220000, 200000 200000))', 82086
72 -- BLOB: SDO_GTYPE, SDO_SRID, SDO_POINT_TYPE, SDO_ELEM_INFO, SDO_ORDINATE
73 2003, 82086, SDO_POINT_TYPE(NULL,NULL,NULL),
74 SDO_ELEM_INFO_ARRAY(1,1003,1),
75 SDO_ORDINATE_ARRAY(200000, 200000, 220000, 200000, 220000, 220000, 200000, 220000, 200000, 200000)
76 )
77);
78
79-- polygon with inner ring
80INSERT INTO SDO_TEST VALUES (
81 4, 'polygon with inner ring', SDO_GEOMETRY(
82 -- WKT
83 -- 'POLYGON((200000 200000, 220000 200000, 220000 220000, 200000 220000, 200000 200000)
84 -- (202000 202000, 208000 208000, 208000 202000, 202000 202000))', 82086
85 -- BLOB: SDO_GTYPE, SDO_SRID, SDO_POINT_TYPE, SDO_ELEM_INFO, SDO_ORDINATE
86 2003, 82086, SDO_POINT_TYPE(NULL,NULL,NULL),
87 SDO_ELEM_INFO_ARRAY(1,1003,1, 11,2003,1),
88 SDO_ORDINATE_ARRAY(200000, 200000, 220000, 200000, 220000, 220000, 200000, 220000, 200000, 200000, 202000, 202000, 208000, 208000, 208000, 202000, 202000, 202000)
89 )
90);
91
92
93-- multi-point
94INSERT INTO SDO_TEST VALUES (
95 5, 'multi point', SDO_GEOMETRY(
96 -- WKT
97 -- 'MULTIPOINT(200000 200000, 220000 200000, 220000 220000, 200000 220000, 200000 200000)', 82086
98 -- BLOB: SDO_GTYPE, SDO_SRID, SDO_POINT_TYPE, SDO_ELEM_INFO, SDO_ORDINATE
99 2005, 82086, SDO_POINT_TYPE(NULL,NULL,NULL),
100 SDO_ELEM_INFO_ARRAY(1,1,1, 3,1,1, 5,1,1, 7,1,1),
101 -- SDO_ELEM_INFO_ARRAY(1,1,4),
102 SDO_ORDINATE_ARRAY(200000, 200000, 220000, 200000, 220000, 220000, 200000, 220000)
103 )
104);
105
106-- multi-line
107INSERT INTO SDO_TEST VALUES (
108 6, 'multi line', SDO_GEOMETRY(
109 -- WKT
110 -- 'MULTILINESTRING((200000 200000, 220000 200000, 220000 220000, 200000 220000)
111 -- (202000 202000, 208000 208000, 208000 202000))', 82086
112 -- BLOB: SDO_GTYPE, SDO_SRID, SDO_POINT_TYPE, SDO_ELEM_INFO, SDO_ORDINATE
113 2006, 82086, SDO_POINT_TYPE(NULL,NULL,NULL),
114 SDO_ELEM_INFO_ARRAY(1,2,1, 9,2,1),
115 SDO_ORDINATE_ARRAY(200000, 200000, 220000, 200000, 220000, 220000, 200000, 220000, 202000, 202000, 208000, 208000, 208000, 202000)
116 )
117);
118
119-- multi-polygon
120INSERT INTO SDO_TEST VALUES (
121 7, 'multi polygon with 1 ring', SDO_GEOMETRY(
122 -- WKT
123 -- 'MULTIPOLYGON(((200000 200000, 220000 200000, 220000 220000, 200000 220000, 200000 200000)))', 82086
124 -- BLOB: SDO_GTYPE, SDO_SRID, SDO_POINT_TYPE, SDO_ELEM_INFO, SDO_ORDINATE
125 2007, 82086, SDO_POINT_TYPE(NULL,NULL,NULL),
126 SDO_ELEM_INFO_ARRAY(1,1003,1),
127 SDO_ORDINATE_ARRAY(200000, 200000, 220000, 200000, 220000, 220000, 200000, 220000, 200000, 200000)
128 )
129);
130
131-- geometry collection
132INSERT INTO SDO_TEST VALUES (
133 8, 'geometry collection - polygon and point', SDO_GEOMETRY(
134 -- WKT
135 -- 'GEOMETRYCOLLECTION(POLYGON(((200000 200000, 220000 200000, 220000 220000, 200000 220000, 200000 200000)),
136 --- LINESTRING(200000 200000, 220000 200000, 220000 220000),POINT(210000 210000))', 82086
137 -- BLOB: SDO_GTYPE, SDO_SRID, SDO_POINT_TYPE, SDO_ELEM_INFO, SDO_ORDINATE
138 2004, 82086, SDO_POINT_TYPE(NULL,NULL,NULL),
139 SDO_ELEM_INFO_ARRAY(1,1003,1, 11,2,1, 17,1,1),
140 SDO_ORDINATE_ARRAY(200000, 200000, 220000, 200000, 220000, 220000, 200000, 220000, 200000, 200000, 200000, 200000, 220000, 200000, 220000, 220000, 210000, 210000)
141 )
142);
143
144-- rectangle
145INSERT INTO SDO_TEST VALUES (
146 9, 'rectangle - 2 points', SDO_GEOMETRY(
147 -- WKT
148 -- 'POLYGON((200000 200000, 220000 200000))', 82086
149 -- BLOB: SDO_GTYPE, SDO_SRID, SDO_POINT_TYPE, SDO_ELEM_INFO, SDO_ORDINATE
150 2003, 82086, SDO_POINT_TYPE(NULL,NULL,NULL),
151 SDO_ELEM_INFO_ARRAY(1,1003,3),
152 SDO_ORDINATE_ARRAY(200000, 200000, 220000, 200000)
153 )
154);
155
156-- circle
157INSERT INTO SDO_TEST VALUES (
158 10, 'circle - 3 points', SDO_GEOMETRY(
159 -- WKT
160 -- 'POLYGON((200000 200000, 220000 200000, 220000 220000))', 82086
161 -- BLOB: SDO_GTYPE, SDO_SRID, SDO_POINT_TYPE, SDO_ELEM_INFO, SDO_ORDINATE
162 2003, 82086, SDO_POINT_TYPE(NULL,NULL,NULL),
163 SDO_ELEM_INFO_ARRAY(1,1003,4),
164 SDO_ORDINATE_ARRAY(200000, 200000, 220000, 200000, 220000, 220000)
165 )
166);
Back to Top