From 86b4df1e81478b36658f24e295353cfe15f69f7c Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Mon, 23 Mar 2015 22:04:43 +0100 Subject: [PATCH] only address features can be linked with placex --- sql/functions.sql | 2 +- tests/features/db/import/linking.feature | 14 + tests/scenes/data/poly-areas.osm | 385 ++++++++++++--------- tests/scenes/data/way-area-with-center.wkt | 5 + 4 files changed, 239 insertions(+), 167 deletions(-) create mode 100644 tests/scenes/data/way-area-with-center.wkt diff --git a/sql/functions.sql b/sql/functions.sql index 194a64d7..5f52a6a9 100644 --- a/sql/functions.sql +++ b/sql/functions.sql @@ -1734,7 +1734,7 @@ BEGIN END IF; -- Name searches can be done for ways as well as relations - IF NEW.osm_type in ('W','R') AND NEW.rank_search < 26 THEN + IF NEW.osm_type in ('W','R') AND NEW.rank_search < 26 AND NEW.rank_address > 0 THEN -- not found one yet? how about doing a name search IF NEW.centroid IS NULL AND (NEW.name->'name') is not null and make_standard_name(NEW.name->'name') != '' THEN diff --git a/tests/features/db/import/linking.feature b/tests/features/db/import/linking.feature index 11602b7d..299087ae 100644 --- a/tests/features/db/import/linking.feature +++ b/tests/features/db/import/linking.feature @@ -2,6 +2,20 @@ Feature: Linking of places Tests for correctly determining linked places + Scenario: Only address-describing places can be linked + Given the scene way-area-with-center + And the place areas + | osm_type | osm_id | class | type | name | geometry + | R | 13 | landuse | forest | Garbo | :area + And the place nodes + | osm_id | class | type | name | geometry + | 256 | natural | peak | Garbo | :inner-C + When importing + Then table placex contains + | object | linked_place_id + | R13 | None + | N256 | None + Scenario: Waterways are linked when in waterway relations Given the scene split-road And the place ways diff --git a/tests/scenes/data/poly-areas.osm b/tests/scenes/data/poly-areas.osm index 917946b7..c6f62770 100644 --- a/tests/scenes/data/poly-areas.osm +++ b/tests/scenes/data/poly-areas.osm @@ -1,168 +1,221 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/scenes/data/way-area-with-center.wkt b/tests/scenes/data/way-area-with-center.wkt new file mode 100644 index 00000000..8a773633 --- /dev/null +++ b/tests/scenes/data/way-area-with-center.wkt @@ -0,0 +1,5 @@ +inner-C | POINT(0.0035625 -0.0066188) +outer-C | POINT(0.0041244 -0.0060007) +inner-N | POINT(0.0018846 -0.0023652) +inner-S | POINT(0.0048516 -0.0095176) +area | MULTIPOLYGON(((0.0077125 -0.0066566,0.0065469 -0.0099414,0.0038979 -0.0109481,0.0026794 -0.0105772,0.0022025 -0.0099944,0.0026264 -0.0091997,0.0026264 -0.0080341,0.0019376 -0.0065507,0.0010369 -0.0072924,0.0005071 -0.0060738,0.0017787 -0.00565,0.0005071 -0.0042195,0.0005601 -0.0025771,0.0013019 -0.0015175,0.0050105 -0.0021533,0.006441 -0.0025771,0.0075006 -0.0040076,0.0033681 -0.0059149,0.0051694 -0.0076633,0.0061231 -0.0064977,0.0068648 -0.0049612,0.0077125 -0.0066566))) -- 2.39.5