construct the polygon only if there are enough points

This commit is contained in:
Motiejus Jakštys 2021-04-16 07:31:11 +03:00
parent 9918ac279f
commit 661647bf48

View File

@ -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;