-- srtext VARCHAR(2000)
--);
--
-INSERT INTO spatial_ref_sys VALUES(101, 'POSC', 32214,
+INSERT INTO spatial_ref_sys (SRID,AUTH_NAME,AUTH_SRID,SRTEXT)
+VALUES (101, 'POSC', 32214,
'PROJCS["UTM_ZONE_14N", GEOGCS["World Geodetic System 72",
DATUM["WGS_72", SPHEROID["NWL_10D", 6378135, 298.26]],
PRIMEM["Greenwich", 0], UNIT["Meter", 1.0]],
-- POSTGIS: to create and register the geometry column.
CREATE TABLE lakes (
fid INTEGER NOT NULL PRIMARY KEY,
- name VARCHAR(64),
- shore POLYGON
+ name VARCHAR(64)
+-- shore POLYGON
);
+SELECT AddGeometryColumn('ogc','lakes','shore','101','POLYGON','2');
--
-- Road Segments
--
fid INTEGER NOT NULL PRIMARY KEY,
name VARCHAR(64),
aliases VARCHAR(64),
- num_lanes INTEGER,
- centerline LINESTRING
+ num_lanes INTEGER
+-- centerline LINESTRING
);
+SELECT AddGeometryColumn('ogc','road_segments','centerline','101','LINESTRING','2');
--
-- Divided Routes
--
CREATE TABLE divided_routes (
fid INTEGER NOT NULL PRIMARY KEY,
name VARCHAR(64),
- num_lanes INTEGER,
- centerlines MULTILINESTRING
+ num_lanes INTEGER
+-- centerlines MULTILINESTRING
);
+SELECT AddGeometryColumn('ogc','divided_routes','centerlines','101','MULTILINESTRING','2');
--
-- Forests
--
--
CREATE TABLE forests (
fid INTEGER NOT NULL PRIMARY KEY,
- name VARCHAR(64),
- boundary MULTIPOLYGON
+ name VARCHAR(64)
+-- boundary MULTIPOLYGON
);
+SELECT AddGeometryColumn('ogc','forests','boundary','101','MULTIPOLYGON','2');
--
-- Bridges
--
--
CREATE TABLE bridges (
fid INTEGER NOT NULL PRIMARY KEY,
- name VARCHAR(64),
- position POINT
+ name VARCHAR(64)
+-- position POINT
);
+SELECT AddGeometryColumn('ogc','bridges','position','101','POINT','2');
--
-- Streams
--
--
CREATE TABLE streams (
fid INTEGER NOT NULL PRIMARY KEY,
- name VARCHAR(64),
- centerline LINESTRING
+ name VARCHAR(64)
+-- centerline LINESTRING
);
+SELECT AddGeometryColumn('ogc','streams','centerline','101','LINESTRING','2');
--
-- Buildings
--
--
CREATE TABLE buildings (
fid INTEGER NOT NULL PRIMARY KEY,
- address VARCHAR(64),
- position POINT,
- footprint POLYGON
+ address VARCHAR(64)
+-- position POINT
+-- footprint POLYGON
);
+SELECT AddGeometryColumn('ogc','buildings','position','101','POINT','2');
+SELECT AddGeometryColumn('ogc','buildings','footprint','101','POLYGON','2');
--
-- Ponds
--
CREATE TABLE ponds (
fid INTEGER NOT NULL PRIMARY KEY,
name VARCHAR(64),
- type VARCHAR(64),
- shores MULTIPOYLGON
+ type VARCHAR(64)
+-- shores MULTIPOYLGON
);
+SELECT AddGeometryColumn('ogc','ponds','shores','101','MULTIPOLYGON','2');
--
-- Named Places
--
--
CREATE TABLE named_places (
fid INTEGER NOT NULL PRIMARY KEY,
- name VARCHAR(64),
- boundary POLYGON
+ name VARCHAR(64)
+-- boundary POLYGON
);
+SELECT AddGeometryColumn('ogc','named_places','boundary','101','POLYGON','2');
--
-- Map Neatline
--
--
--
CREATE TABLE map_neatlines (
- fid INTEGER NOT NULL PRIMARY KEY,
- neatline POLYGON
+ fid INTEGER NOT NULL PRIMARY KEY
+-- neatline POLYGON
);
+SELECT AddGeometryColumn('ogc','map_neatlines','neatline','101','POLYGON','2');
--
--
--
--==============================================================================
--
--
-INSERT INTO lakes VALUES (101, 'BLUE LAKE',
+INSERT INTO lakes VALUES (101, 'Blue Lake',
PolygonFromText('POLYGON((52 18,66 23,73 9,48 6,52 18),(59 18,67 18,67 13,59 13,59 18))', 101)
);
--
--================================
--
SELECT GeometryType(centerlines)
-FROM lakes
+FROM divided_routes
WHERE name = 'Route 75';
--
--================================
--
--================================
--
-SELECT AsText(Boundary((boundary))
+SELECT AsText(Boundary(boundary))
FROM named_places
WHERE name = 'Goose Island';
--
--
--================================
--
-SELECT AsText(Envelope((boundary))
+SELECT AsText(Envelope(boundary))
FROM named_places
WHERE name = 'Goose Island';
--
--
SELECT X(position)
FROM bridges
-WHERE name = 'Bridges';
+WHERE name = 'Cam Bridge';
--
--================================
-- Conformance Item T16
--
SELECT Y(position)
FROM bridges
-WHERE name = 'Bridges';
+WHERE name = 'Cam Bridge';
--
--
--
--
--================================
--
-SELECT Overlap(forest.boundary, named_places.boundary)
+SELECT Overlap(forests.boundary, named_places.boundary)
FROM forests, named_places
WHERE forests.name = 'Green Forest' AND named_places.name = 'Ashton';
--
--
--================================
--
-SELECT Contains(forest.boundary, named_places.boundary)
+SELECT Contains(forests.boundary, named_places.boundary)
FROM forests, named_places
WHERE forests.name = 'Green Forest' AND named_places.name = 'Ashton';
--
--
--================================
--
-SELECT Relate(forest.boundary, named_places.boundary, 'TTTTTTTTT')
+SELECT Relate(forests.boundary, named_places.boundary, 'TTTTTTTTT')
FROM forests, named_places
WHERE forests.name = 'Green Forest' AND named_places.name = 'Ashton';
--