diff schema/gemma.sql @ 1983:f9f1babe52ae

Fix area generation from multipolygon input In case the waterway axis representing a stretch intersects distinct parts of the input area, a multipolygon has to be returned. Before, an arbitrary polygon was selected due to the used function not being set-returning. In passing, consistently name respective columns in schema.
author Tom Gottfried <tom@intevation.de>
date Wed, 23 Jan 2019 16:25:43 +0100
parents d966f03ea819
children 48001472e1d8 8eeb0b5eb340
line wrap: on
line diff
--- a/schema/gemma.sql	Wed Jan 23 16:18:36 2019 +0100
+++ b/schema/gemma.sql	Wed Jan 23 16:25:43 2019 +0100
@@ -351,10 +351,7 @@
         id int PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
         name varchar NOT NULL,
         stretch isrsrange NOT NULL,
-        -- TODO: make it a (MULTI)-LINESTRING.
-        -- POLYGON is chosen for the convinience
-        -- of re-using ISRSrange_area.
-        geom geography(POLYGON, 4326) NOT NULL,
+        area geography(MULTIPOLYGON, 4326) NOT NULL,
         objnam varchar NOT NULL,
         nobjnam varchar,
         date_info timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
@@ -376,7 +373,7 @@
         name,
         (stretch).lower::varchar as lower,
         (stretch).upper::varchar as upper,
-        geom::Geometry(POLYGON, 4326),
+        area::Geometry(MULTIPOLYGON, 4326),
         objnam,
         nobjnam,
         date_info,
@@ -442,7 +439,7 @@
         objnam varchar,
         nobjnm varchar,
         stretch isrsrange NOT NULL,
-        area geography(POLYGON, 4326) NOT NULL,
+        area geography(MULTIPOLYGON, 4326) NOT NULL,
         rb char(2) NOT NULL REFERENCES countries, -- from rb_lb in interface
         lb char(2) NOT NULL REFERENCES countries, -- from rb_lb in interface
         responsible_country char(2) NOT NULL REFERENCES countries,