From e25499668e622b22e871d74b844062329cc36211 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Wed, 19 May 2021 22:57:51 +0300 Subject: [PATCH] check more carefully for intersections --- visuals.sql | 3 +-- wm.sql | 9 ++++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/visuals.sql b/visuals.sql index f841b8f..7a4f584 100644 --- a/visuals.sql +++ b/visuals.sql @@ -125,8 +125,7 @@ begin ('salvis-visvalingam-' || i, geom2), ('salvis-visvalingam-' || i || '-chaikin', st_chaikinsmoothing(geom2, 5)); end loop; - --foreach i in array array[75, 375] loop - foreach i in array array[75] loop + foreach i in array array[75, 375] loop geom3 = st_simplifywm((select way from wm_visuals where name='salvis'), i, 50, 'salvis-wm-' || i); insert into wm_visuals(name, way) values ('salvis-wm-' || i, geom3); diff --git a/wm.sql b/wm.sql index 0cb940b..ae0d7f1 100644 --- a/wm.sql +++ b/wm.sql @@ -531,12 +531,20 @@ begin continue when st_intersects(bend, st_removepoint(st_removepoint(bends[i-1], n-1), n-2)); end if; + if n > 2 then + tmpint = st_intersection(bend, st_removepoint(bends[i-1], n-1)); + continue when st_npoints(tmpint) > 1; + end if; n = st_npoints(bends[i+1]); if n > 3 then continue when st_intersects(bend, st_removepoint(st_removepoint(bends[i+1], 0), 0)); end if; + if n > 2 then + tmpint = st_intersection(bend, st_removepoint(bends[i+1], 0)); + continue when st_npoints(tmpint) > 1; + end if; for n in -intersect_patience+1..intersect_patience-1 loop continue when n in (-1, 0, 1); @@ -727,7 +735,6 @@ begin mutated = true; gen = 1; - raise notice 'dbgname: %, gen: %', dbgname, gen; while mutated loop if dbgname is not null then insert into wm_debug (stage, name, gen, nbend, way) values(