Mercurial > dive4elements > river
view flys-backend/doc/schema/postgresql-spatial.sql @ 1237:774dff3ee546
Added relation and hibernate classes for floodplains (german 'Talaue').
flys-backend/trunk@2615 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 31 Aug 2011 08:50:20 +0000 |
parents | 324cb486db9f |
children | 35740d675866 |
line wrap: on
line source
BEGIN; CREATE TABLE river_axes ( id SERIAL PRIMARY KEY NOT NULL, river_id int REFERENCES rivers(id), kind int NOT NULL DEFAULT 0 ); SELECT AddGeometryColumn('river_axes', 'geom', 31466, 'LINESTRING', 2); CREATE TABLE cross_section_tracks ( id SERIAL PRIMARY KEY NOT NULL, river_id int REFERENCES rivers(id), km NUMERIC NOT NULL, z NUMERIC NOT NULL DEFAULT 0 ); SELECT AddGeometryColumn('cross_section_tracks', 'geom', 31466, 'LINESTRING', 2); CREATE TABLE lines ( id SERIAL PRIMARY KEY NOT NULL, river_id int REFERENCES rivers(id), kind int NOT NULL DEFAULT 0, z NUMERIC DEFAULT 0 ); SELECT AddGeometryColumn('lines', 'geom', 31466, 'LINESTRING', 4); -- 'kind': -- 0: ROHR1 -- 1: DAMM CREATE TABLE buildings ( id SERIAL PRIMARY KEY NOT NULL, river_id int REFERENCES rivers(id), name VARCHAR(50) ); SELECT AddGeometryColumn('buildings', 'geom', 31466, 'LINESTRING', 2); CREATE TABLE fixpoints ( id SERIAL PRIMARY KEY NOT NULL, river_id int REFERENCES rivers(id), x int, y int, km NUMERIC NOT NULL, HPGP VARCHAR(2) ); SELECT AddGeometryColumn('fixpoints', 'geom', 31466, 'POINT', 2); -- Talaue CREATE TABLE floodplain ( id SERIAL PRIMARY KEY NOT NULL, river_id int REFERENCES rivers(id) ); SELECT AddGeometryColumn('floodplain', 'geom', 31466, 'MULTIPOLYGON', 2); CREATE TABLE dgm ( id SERIAL PRIMARY KEY NOT NULL, river_id int REFERENCES rivers(id), -- XXX Should we use the ranges table instead? lower NUMERIC, upper NUMERIC, path VARCHAR(256), UNIQUE (river_id, lower, upper) ); END;