diff schema/gemma.sql @ 944:feef06db5d9d geo-style

Merged default into geo-style branch.
author Sascha L. Teichmann <teichmann@intevation.de>
date Wed, 10 Oct 2018 00:16:31 +0200
parents e758e12b38c9 e6220a19f284
children 5f89868bd75e
line wrap: on
line diff
--- a/schema/gemma.sql	Mon Oct 08 14:53:17 2018 +0200
+++ b/schema/gemma.sql	Wed Oct 10 00:16:31 2018 +0200
@@ -107,10 +107,12 @@
     reference_water_level varchar(20) PRIMARY KEY
 );
 
-CREATE TABLE distance_mark_functions (
-    -- XXX: Redundant information to object code in isrs code of dist. mark
-    distance_mark_function varchar(8) PRIMARY KEY
+CREATE TABLE catdis (
+    catdis smallint PRIMARY KEY
+    -- TODO: Do we need name and/or definition from IENC feature catalogue?
+    -- (see page 171 of edition 2.3)
 );
+INSERT INTO catdis VALUES (1), (2), (3), (4);
 
 CREATE TABLE position_codes (
     position_code char(2) PRIMARY KEY
@@ -287,10 +289,7 @@
     CREATE TABLE distance_marks (
         location_code isrs PRIMARY KEY,
         geom geography(POINT, 4326) NOT NULL,
-        distance_mark_function varchar(8)
-            NOT NULL REFERENCES distance_mark_functions,
-        -- XXX: attribute "function" in DRC 2.1.7 as well as CATDIS seem
-        -- to encode the same thing as the object code in ISRS location code.
+        catdis smallint NOT NULL REFERENCES catdis,
         position_code char(2) NOT NULL REFERENCES position_codes
     )
 
@@ -300,7 +299,7 @@
     CREATE VIEW waterway.distance_marks_geoserver AS
         SELECT location_code::VARCHAR,
                geom::Geometry(POINT, 4326),
-               distance_mark_function,
+               catdis,
                position_code,
                (location_code).hectometre
             FROM waterway.distance_marks