fix integration tests

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

6
wm.sql
View File

@ -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',