From 5d430d34d118c0f69191d1e70e164061b4b450c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Wed, 19 May 2021 22:57:48 +0300 Subject: [PATCH] construct the polygon only if there are enough points --- wm.sql | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/wm.sql b/wm.sql index 871ee6a..9aebf41 100644 --- a/wm.sql +++ b/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;