isolated bends
This commit is contained in:
parent
8fb18f0795
commit
3515dab508
@ -1,6 +1,6 @@
|
||||
SOURCE ?= lithuania-latest.osm.pbf
|
||||
#WHERE ?= name='Visinčia' OR name='Šalčia' OR name='Nemunas' OR name='Žeimena' OR name='Lakaja'
|
||||
WHERE ?= name='Žeimena' OR name='Lakaja'
|
||||
WHERE ?= name='Visinčia' OR name='Šalčia' OR name='Nemunas' OR name='Žeimena' OR name='Lakaja'
|
||||
#WHERE ?= name='Žeimena' OR name='Lakaja'
|
||||
SLIDES = slides-2021-03-29.pdf
|
||||
|
||||
NON_ARCHIVABLES = notes.txt referatui.txt slides-2021-03-29.txt
|
||||
|
@ -22,7 +22,7 @@ end
|
||||
$$ language plpgsql;
|
||||
|
||||
-- to preview this somewhat conveniently in QGIS:
|
||||
-- stage || '_' || name || ' gen:' || coalesce(gen, 'Ø') || ' nbend:' || lpad(nbend, 2, '0')
|
||||
-- stage || '_' || name || ' gen:' || coalesce(gen, 'Ø') || ' nbend:' || lpad(nbend, 4, '0')
|
||||
drop table if exists wm_debug;
|
||||
create table wm_debug(stage text, name text, gen bigint, nbend bigint, way geometry, props jsonb);
|
||||
|
||||
|
23
IV/wm.sql
23
IV/wm.sql
@ -330,31 +330,30 @@ $$ language plpgsql;
|
||||
|
||||
create function isolated_bends(INOUT bendattrs t_bend_attrs[], dbgname text default null) as $$
|
||||
declare
|
||||
isolation_threshold constant real default 0.2; -- if neighbor's curvatures are within, it's isolated
|
||||
isolation_threshold constant real default 0.33; -- if neighbor's curvatures are within, it's isolated
|
||||
this real;
|
||||
skip_next bool;
|
||||
res t_bend_attrs;
|
||||
prev_i int4;
|
||||
i int4;
|
||||
begin
|
||||
i = 2;
|
||||
while i < array_length(bendattrs, 1)-1 loop
|
||||
this = bendattrs[i].curvature * isolation_threshold;
|
||||
prev_i = i;
|
||||
if bendattrs[i-1].curvature < this and bendattrs[i+1].curvature < this then
|
||||
raise notice '% %`th bend is isolated', dbgname, i;
|
||||
for i in 2..array_length(bendattrs, 1)-1 loop
|
||||
res = bendattrs[i];
|
||||
if skip_next then
|
||||
skip_next = false;
|
||||
else
|
||||
this = bendattrs[i].curvature * isolation_threshold;
|
||||
if bendattrs[i-1].curvature < this and bendattrs[i+1].curvature < this then
|
||||
res.isolated = true;
|
||||
bendattrs[i] = res;
|
||||
i = i + 2;
|
||||
else
|
||||
i = i + 1;
|
||||
skip_next = true;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
if dbgname is not null then
|
||||
insert into wm_debug (stage, name, nbend, way, props) values(
|
||||
'fisolated_bends',
|
||||
dbgname,
|
||||
prev_i,
|
||||
i,
|
||||
res.bend,
|
||||
jsonb_build_object(
|
||||
'isolated', res.isolated
|
||||
|
Loading…
Reference in New Issue
Block a user