diff --git a/IV/Makefile b/IV/Makefile index 40ee55a..2d048df 100644 --- a/IV/Makefile +++ b/IV/Makefile @@ -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 diff --git a/IV/tests.sql b/IV/tests.sql index 4606c63..c4759ef 100644 --- a/IV/tests.sql +++ b/IV/tests.sql @@ -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); diff --git a/IV/wm.sql b/IV/wm.sql index e053c1b..77d2da5 100644 --- a/IV/wm.sql +++ b/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; - res = bendattrs[i]; - res.isolated = true; - bendattrs[i] = res; - i = i + 2; + for i in 2..array_length(bendattrs, 1)-1 loop + res = bendattrs[i]; + if skip_next then + skip_next = false; else - i = i + 1; + 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; + 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