Mercurial > gemma
comparison 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 |
comparison
equal
deleted
inserted
replaced
5008:0b97f5301a17 | 5009:e8b2dc771f9e |
---|---|
59 BEGIN | 59 BEGIN |
60 -- Find best matchting UTM zone | 60 -- Find best matchting UTM zone |
61 z = best_utm(stretch); | 61 z = best_utm(stretch); |
62 | 62 |
63 CREATE TEMP TABLE axis AS | 63 CREATE TEMP TABLE axis AS |
64 SELECT id, wtwaxs, ST_Boundary(wtwaxs) AS bdr | 64 SELECT row_number() OVER () AS id, |
65 FROM (SELECT id, ST_Transform(wtwaxs::geometry, z) AS wtwaxs | 65 geom AS wtwaxs, |
66 FROM waterway.waterway_axis) AS axs; | 66 ST_Boundary(geom) AS bdr |
67 FROM waterway.waterway_axis, | |
68 ST_Dump(ST_Transform(wtwaxs::geometry, z)); | |
67 CREATE INDEX axs_bdr ON axis USING GiST (bdr); | 69 CREATE INDEX axs_bdr ON axis USING GiST (bdr); |
68 ANALYZE axis; | 70 ANALYZE axis; |
69 | 71 |
70 WITH RECURSIVE | 72 WITH RECURSIVE |
71 -- In order to guarantee the following ST_Covers to work, | 73 -- In order to guarantee the following ST_Covers to work, |