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 declare
len int4; len int4;
bends1 geometry[]; bends1 geometry[];
dbgpolygon geometry;
begin begin
len = array_length(bends, 1); len = array_length(bends, 1);
@ -133,12 +134,18 @@ begin
i, i,
bends[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( insert into wm_debug(stage, name, gen, nbend, way) values(
'cinflections-polygon', 'cinflections-polygon',
dbgname, dbgname,
dbgstagenum, dbgstagenum,
i, i,
st_makepolygon(st_addpoint(bends[i], st_startpoint(bends[i]))) dbgpolygon
); );
end loop; end loop;
end if; end if;