From 35c7269bac84241c12bae21d0da8feffc631a729 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Sat, 16 Dec 2017 16:59:48 +0100 Subject: [PATCH] when linking waterway ways and relations allow all river-like types Fixes #848 --- sql/functions.sql | 2 +- test/bdd/db/import/linking.feature | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sql/functions.sql b/sql/functions.sql index 1691e235..58d3fc7d 100644 --- a/sql/functions.sql +++ b/sql/functions.sql @@ -1355,7 +1355,7 @@ BEGIN --DEBUG: RAISE WARNING 'waterway parent %, child %/%', NEW.osm_id, i, relation_members[i]; FOR linked_node_id IN SELECT place_id FROM placex WHERE osm_type = 'W' and osm_id = substring(relation_members[i],2,200)::bigint - and class = NEW.class and type = NEW.type + and class = NEW.class and type in ('river', 'stream', 'canal', 'drain', 'ditch') and ( relation_members[i+1] != 'side_stream' or NEW.name->'name' = name->'name') LOOP UPDATE placex SET linked_place_id = NEW.place_id WHERE place_id = linked_node_id; diff --git a/test/bdd/db/import/linking.feature b/test/bdd/db/import/linking.feature index ecb1c9df..ceb45586 100644 --- a/test/bdd/db/import/linking.feature +++ b/test/bdd/db/import/linking.feature @@ -40,11 +40,11 @@ Feature: Linking of places Scenario: Relations are not linked when in waterway relations Given the scene split-road And the places - | osm | class | type | name | geometry | - | W1 | waterway | river | Rhein | :w-2 | - | W2 | waterway | river | Rhein | :w-3 | - | R1 | waterway | river | Rhein | :w-1 + :w-2 + :w-3 | - | R2 | waterway | river | Limmat| :w-4a | + | osm | class | type | name | geometry | + | W1 | waterway | stream | Rhein | :w-2 | + | W2 | waterway | river | Rhein | :w-3 | + | R1 | waterway | river | Rhein | :w-1 + :w-2 + :w-3 | + | R2 | waterway | river | Limmat| :w-4a | And the relations | id | members | tags+type | | 1 | R2 | waterway | @@ -69,11 +69,11 @@ Feature: Linking of places | object | linked_place_id | | R1 | - | - Scenario: Waterways are not linked when waterway types don't match + Scenario: Waterways are not linked when the way type is not a river feature Given the scene split-road And the places | osm | class | type | name | geometry | - | W1 | waterway | drain | Rhein | :w-2 | + | W1 | waterway | lock | Rhein | :w-2 | | R1 | waterway | river | Rhein | :w-1 + :w-2 + :w-3 | And the relations | id | members | tags+type | -- 2.39.5