From 661647bf4892c7017108326a1204c9c253e3f220 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Fri, 16 Apr 2021 07:31:11 +0300 Subject: [PATCH] construct the polygon only if there are enough points --- IV/wm.sql | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/IV/wm.sql b/IV/wm.sql index 871ee6a..9aebf41 100644 --- a/IV/wm.sql +++ b/IV/wm.sql @@ -111,6 +111,7 @@ create or replace function fix_gentle_inflections( declare len int4; bends1 geometry[]; + dbgpolygon geometry; begin len = array_length(bends, 1); @@ -133,12 +134,18 @@ begin i, bends[i] ); + + dbgpolygon = null; + if st_npoints(bends[i]) >= 3 then + dbgpolygon = st_makepolygon(st_addpoint(bends[i], st_startpoint(bends[i]))); + end if; + insert into wm_debug(stage, name, gen, nbend, way) values( 'cinflections-polygon', dbgname, dbgstagenum, i, - st_makepolygon(st_addpoint(bends[i], st_startpoint(bends[i]))) + dbgpolygon ); end loop; end if;