fix integration tests

This commit is contained in:
Motiejus Jakštys 2021-05-19 22:57:47 +03:00 committed by Motiejus Jakštys
parent 41a14a1ded
commit cf109dc454
2 changed files with 5 additions and 5 deletions

View File

@ -1,8 +1,8 @@
\i wm.sql \i wm.sql
drop table if exists debug_wm; 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; drop table if exists demo_wm;
create table demo_wm (name text, i bigint, way geometry); 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;

6
wm.sql
View File

@ -280,11 +280,9 @@ declare
begin begin
fourpi = 4*radians(180); fourpi = 4*radians(180);
for i in 1..array_length(bends, 1) loop for i in 1..array_length(bends, 1) loop
res = null;
bend = bends[i]; bend = bends[i];
if st_numpoints(bend) < 3 then if st_numpoints(bend) < 3 then
res.cmp = 0;
res.area = 0;
res.bend = null;
polygon = null; polygon = null;
else else
select st_makepolygon(st_addpoint(bend, st_startpoint(bend))) into polygon; 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 fourpi*res.area/(st_perimeter(polygon)^2) into res.cmp;
select bend into res.bend; select bend into res.bend;
end if; end if;
if res.area > 0 then if res.area > 0 then
select (res.area*(0.75/res.cmp)) into res.adjsize; select (res.area*(0.75/res.cmp)) into res.adjsize;
end if; end if;
if dbgname is not null then if dbgname is not null then
insert into debug_wm (stage, name, nbend, way, props) values( insert into debug_wm (stage, name, nbend, way, props) values(
'ebendattrs', 'ebendattrs',