From 36380339b9134bee928092010bd72af8fe2ddaed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Tue, 11 May 2021 09:13:30 +0300 Subject: [PATCH] eliminate small bends and reduce isolation_threshold too many bends get "isolated". The criteria needs to be updated, for now just reducing the threshold improves the situation a bit. --- IV/visuals.sql | 27 +++++++++++++++++---------- IV/wm.sql | 2 +- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/IV/visuals.sql b/IV/visuals.sql index 89e74a0..751a6d1 100644 --- a/IV/visuals.sql +++ b/IV/visuals.sql @@ -68,16 +68,23 @@ end $$ language plpgsql; delete from wm_visuals where name like 'salvis%'; insert into wm_visuals(name, way) values('salvis', ( - select st_intersection( - (select st_union(way) from wm_rivers where name in ('Šalčia', 'Visinčia')), - wm_bbox( - st_closestpoint( - (select way from wm_rivers where name='Šalčia'), - (select way from wm_rivers where name='Visinčia') - ), - :scaledwidth - ) + with multismall as ( + select st_intersection( + (select st_union(way) from wm_rivers where name in ('Šalčia', 'Visinčia')), + wm_bbox( + st_closestpoint( + (select way from wm_rivers where name='Šalčia'), + (select way from wm_rivers where name='Visinčia') + ), + :scaledwidth + ) + ) ways ) + -- protecting against very small bends that were cut + -- in the corner of the picture + select st_union(a.geom) + from st_dump((select ways from multismall)) a + where st_length(a.geom) >= 100 )); do $$ @@ -110,7 +117,7 @@ begin foreach i in array array[16, 64, 256] loop geom1 = st_simplify((select way from wm_visuals where name='salvis'), i); geom2 = st_simplifyvw((select way from wm_visuals where name='salvis'), i*i); - geom3 = st_simplifywm((select way from wm_visuals where name='salvis'), i); + geom3 = st_simplifywm((select way from wm_visuals where name='salvis'), i, 50, 'salvis-' || i); insert into wm_visuals(name, way) values ('salvis-douglas-' || i, geom1), ('salvis-douglas-' || i || '-chaikin', st_chaikinsmoothing(geom1, 5)), diff --git a/IV/wm.sql b/IV/wm.sql index 0c962c6..4a64bc9 100644 --- a/IV/wm.sql +++ b/IV/wm.sql @@ -335,7 +335,7 @@ create function wm_bend_attrs( dbggen integer default null ) returns wm_t_attrs[] as $$ declare - isolation_threshold constant real default 0.5; + isolation_threshold constant real default 0.3; attrs wm_t_attrs[]; attr wm_t_attrs; bend geometry;