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.
This commit is contained in:
Motiejus Jakštys 2021-05-11 09:13:30 +03:00
parent dd9fd60cd0
commit 36380339b9
2 changed files with 18 additions and 11 deletions

View File

@ -68,16 +68,23 @@ end $$ language plpgsql;
delete from wm_visuals where name like 'salvis%'; delete from wm_visuals where name like 'salvis%';
insert into wm_visuals(name, way) values('salvis', ( insert into wm_visuals(name, way) values('salvis', (
select st_intersection( with multismall as (
(select st_union(way) from wm_rivers where name in ('Šalčia', 'Visinčia')), select st_intersection(
wm_bbox( (select st_union(way) from wm_rivers where name in ('Šalčia', 'Visinčia')),
st_closestpoint( wm_bbox(
(select way from wm_rivers where name='Šalčia'), st_closestpoint(
(select way from wm_rivers where name='Visinčia') (select way from wm_rivers where name='Šalčia'),
), (select way from wm_rivers where name='Visinčia')
:scaledwidth ),
) :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 $$ do $$
@ -110,7 +117,7 @@ begin
foreach i in array array[16, 64, 256] loop foreach i in array array[16, 64, 256] loop
geom1 = st_simplify((select way from wm_visuals where name='salvis'), i); 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); 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 insert into wm_visuals(name, way) values
('salvis-douglas-' || i, geom1), ('salvis-douglas-' || i, geom1),
('salvis-douglas-' || i || '-chaikin', st_chaikinsmoothing(geom1, 5)), ('salvis-douglas-' || i || '-chaikin', st_chaikinsmoothing(geom1, 5)),

View File

@ -335,7 +335,7 @@ create function wm_bend_attrs(
dbggen integer default null dbggen integer default null
) returns wm_t_attrs[] as $$ ) returns wm_t_attrs[] as $$
declare declare
isolation_threshold constant real default 0.5; isolation_threshold constant real default 0.3;
attrs wm_t_attrs[]; attrs wm_t_attrs[];
attr wm_t_attrs; attr wm_t_attrs;
bend geometry; bend geometry;