add wm_rivers_50 and wm_rivers_250 to wm_visuals

This commit is contained in:
Motiejus Jakštys 2021-05-19 22:57:51 +03:00 committed by Motiejus Jakštys
parent 2ff4588320
commit 81593ff92b

View File

@ -66,27 +66,57 @@ begin
end $$ language plpgsql; end $$ language plpgsql;
drop function if exists wm_salvisbbox;
create function wm_salvisbbox(
geom geometry,
scaledwidth float
) returns geometry as $$
declare
ret geometry;
begin
with multismall as (
select st_intersection(
st_union(geom),
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
into ret;
return ret;
end $$ language plpgsql;
delete from wm_debug where name like 'salvis%'; delete from wm_debug where name like 'salvis%';
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
with multismall as ( ('salvis', (
select st_intersection( wm_salvisbbox(
(select st_union(way) from wm_rivers where name in ('Šalčia', 'Visinčia')), (select st_union(way) from wm_rivers where name in ('Šalčia', 'Visinčia')),
wm_bbox( :scaledwidth
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 ('salvis-50', (
select st_union(a.geom) wm_salvisbbox(
from st_dump((select ways from multismall)) a (select st_union(way) from wm_rivers_50 where name in ('Šalčia', 'Visinčia')),
where st_length(a.geom) >= 100 :scaledwidth
)); )
)),
('salvis-250', (
wm_salvisbbox(
(select st_union(way) from wm_rivers_250 where name in ('Šalčia', 'Visinčia')),
:scaledwidth
)
));
do $$ do $$
declare declare