view flys-backend/doc/schema/postgresql-spatial.sql @ 1230:e2deda3b77a7

Introduced support for FLYS spatial data. flys-backend/trunk@2507 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 18 Aug 2011 15:03:20 +0000
parents
children 324cb486db9f
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);

END;

http://dive4elements.wald.intevation.org