wm

Wang–Müller line generalization algorithm in PostGIS
Log | Files | Refs | README | LICENSE

commit 02f2ac3e60ac375c4a6748c9553bfdffe3f02f95 (tree)
parent fab653ee3a3877755ea442113417c979b6d00e09
Author: Motiejus Jakštys <motiejus@jakstys.lt>
Date:   Wed, 19 May 2021 22:57:45 +0300

add safety check

Diffstat:
Mwm.sql | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/wm.sql b/wm.sql @@ -117,6 +117,9 @@ begin select geom from st_dumppoints(bends[i]) order by path[1] asc limit 3 ) into phead; + -- if the bend got too short, stop processing it + exit when array_length(phead, 1) < 3; + -- if inflection angle between ptail[1:3] "large", stop processing this bend exit when abs(st_angle(phead[1], phead[2], phead[3]) - pi) > small_angle;