add wm_rivers_50 and wm_rivers_250 to wm_visuals

This commit is contained in:
Motiejus Jakštys 2021-05-16 15:37:34 +03:00
parent ee96ae4c03
commit 998e99e4b3

View File

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