Mercurial > gemma
changeset 2956:974122125a76
Let it be an error if closest points of DISMARs on axis are equal
This might be the case e.g. if both distance marks are very far
away from the available axis geometries. Instead of returning a
point in such a case, which would likely be an unexpected result,
raise an exception by means of STRICT.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Mon, 08 Apr 2019 14:53:09 +0200 |
parents | e9ff3e8d3c46 |
children | b74ebeb2bdc8 |
files | schema/isrs_functions.sql |
diffstat | 1 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/schema/isrs_functions.sql Mon Apr 08 11:58:00 2019 +0200 +++ b/schema/isrs_functions.sql Mon Apr 08 14:53:09 2019 +0200 @@ -65,13 +65,18 @@ FROM waterway.waterway_axis, utm_zone), -- In order to guarantee the following ST_Covers to work, -- snap distance mark coordinates to axis - points AS ( + points0 AS ( SELECT ST_ClosestPoint( wtwaxs, ST_Transform(geom, z)) AS geom FROM ST_Dump(ISRSrange_points(stretch)), utm_zone, ( SELECT ST_Collect(wtwaxs) AS wtwaxs FROM axis) AS ax), + -- Ensure two distinct points on axis have been found + points AS ( + SELECT geom + FROM points0 + WHERE 2 = (SELECT count(DISTINCT geom) FROM points0)), axis_snapped AS ( -- Iteratively connect non-contiguous axis chunks -- to find the contiguous axis on which given distance marks lie @@ -119,8 +124,8 @@ -- end of the resulting linestring, that significantly differ from -- the direction of the input linestring due to finite precision -- of the calculation. The generated small segment of the - -- resulting line leads to unexpected results of the buffer with - -- endcap=flat in the CTE below. + -- resulting line would lead e.g. to unexpected results in an area + -- generated by ISRSrange_area(). SELECT ST_SimplifyPreserveTopology(ST_LineSubstring( axis_segment.line, min(fractions.f), max(fractions.f)), 0.0001) AS line