From 0d805d1be652a86ded47e176c7896009f3240480 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Tue, 6 Apr 2021 07:08:39 +0300 Subject: [PATCH] fix integration tests --- IV/tests-integration.sql | 4 ++-- IV/wm.sql | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/IV/tests-integration.sql b/IV/tests-integration.sql index fbd7032..0a0e2be 100644 --- a/IV/tests-integration.sql +++ b/IV/tests-integration.sql @@ -1,8 +1,8 @@ \i wm.sql drop table if exists debug_wm; -create table debug_wm(name text, way geometry, props json); +create table debug_wm(stage text, name text, gen bigint, nbend bigint, way geometry, props json); drop table if exists demo_wm; create table demo_wm (name text, i bigint, way geometry); -insert into demo_wm (name, way) select name, ST_SimplifyWM(way, true) from agg_rivers; +insert into demo_wm (name, way) select name, ST_SimplifyWM(way, name) from agg_rivers; diff --git a/IV/wm.sql b/IV/wm.sql index 5513281..1e0db66 100644 --- a/IV/wm.sql +++ b/IV/wm.sql @@ -280,11 +280,9 @@ declare begin fourpi = 4*radians(180); for i in 1..array_length(bends, 1) loop + res = null; bend = bends[i]; if st_numpoints(bend) < 3 then - res.cmp = 0; - res.area = 0; - res.bend = null; polygon = null; else select st_makepolygon(st_addpoint(bend, st_startpoint(bend))) into polygon; @@ -301,9 +299,11 @@ begin select fourpi*res.area/(st_perimeter(polygon)^2) into res.cmp; select bend into res.bend; end if; + if res.area > 0 then select (res.area*(0.75/res.cmp)) into res.adjsize; end if; + if dbgname is not null then insert into debug_wm (stage, name, nbend, way, props) values( 'ebendattrs',