Mercurial > gemma
diff schema/isrs_functions.sql @ 5009:e8b2dc771f9e
Store axis as MultiLinestring
MultiLinestrings could already be imported but we stored them as
multiple Linestrings with identical attributes and even stored
Linestrings with self-intersections as multiple single Linestrings
with identical attributes. Avoid both by storing as MultiLinestring.
In passing, removed unnecessary processing steps in the INSERT
statemet for the sys_admin case and ensured that attempts to
convert to valid simple features are made after transformation,
which might lead to invalid features.
Since isrsrange_axis() relies on single Linestrings for linear
referencing, add an extra ST_Dump().
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Wed, 11 Mar 2020 17:11:23 +0100 |
parents | 0d45a3c34900 |
children | 68358e4603c8 |
line wrap: on
line diff
--- a/schema/isrs_functions.sql Wed Mar 11 15:54:37 2020 +0100 +++ b/schema/isrs_functions.sql Wed Mar 11 17:11:23 2020 +0100 @@ -61,9 +61,11 @@ z = best_utm(stretch); CREATE TEMP TABLE axis AS - SELECT id, wtwaxs, ST_Boundary(wtwaxs) AS bdr - FROM (SELECT id, ST_Transform(wtwaxs::geometry, z) AS wtwaxs - FROM waterway.waterway_axis) AS axs; + SELECT row_number() OVER () AS id, + geom AS wtwaxs, + ST_Boundary(geom) AS bdr + FROM waterway.waterway_axis, + ST_Dump(ST_Transform(wtwaxs::geometry, z)); CREATE INDEX axs_bdr ON axis USING GiST (bdr); ANALYZE axis;