From 79952c09c96b4381a6ebc0bfb159db737e21de7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Fri, 16 Apr 2021 08:05:17 +0300 Subject: [PATCH] better estimation --- IV/tests-integration.sql | 2 +- IV/wm.sql | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/IV/tests-integration.sql b/IV/tests-integration.sql index 8d82567..2ea67cd 100644 --- a/IV/tests-integration.sql +++ b/IV/tests-integration.sql @@ -10,7 +10,7 @@ declare begin select * from ST_SimplifyWM_Estimate((select st_union(way) from agg_rivers)) into npoints, secs; raise notice 'Total points: %', npoints; - raise notice 'Expected duration: %s (+-%s), depending on bend complexity', ceil(secs), floor(secs*.5); + raise notice 'Expected duration: %s (+-%s)', ceil(secs), floor(secs*.5); end $$ language plpgsql; drop table if exists wm_demo; diff --git a/IV/wm.sql b/IV/wm.sql index d373b05..f359a45 100644 --- a/IV/wm.sql +++ b/IV/wm.sql @@ -19,6 +19,7 @@ declare prev_sign int4; cur_sign int4; l_type text; + dbgpolygon geometry; begin l_type = st_geometrytype(line); if l_type != 'ST_LineString' then @@ -82,12 +83,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( 'bbends-polygon', dbgname, dbgstagenum, i, - st_makepolygon(st_addpoint(bends[i], st_startpoint(bends[i]))) + dbgpolygon ); end loop; end if;