bdd: move import tests from scenes to grid descriptions

This commit is contained in:
Sarah Hoffmann 2022-06-15 22:22:13 +02:00
parent 3493d317e4
commit 02068aec7f
10 changed files with 829 additions and 568 deletions

View File

@ -253,38 +253,52 @@ Feature: Address computation
| W1 | W10 |
Scenario: buildings with only addr:postcodes do not appear in the address of a way
Given the scene admin-areas
Given the grid with origin DE
| 1 | | | | | 8 | | 6 | | 2 |
| |10 |11 | | | | | | | |
| |13 |12 | | | | | | | |
| 20| | | 21| | | | | | |
| | | | | | | | | | |
| | | | | | 9 | | | | |
| 4 | | | | | | | 7 | | 3 |
And the named places
| osm | class | type | admin | addr+postcode | geometry |
| R1 | boundary | administrative | 6 | 112 | :b0 |
| R34 | boundary | administrative | 8 | 112 DE | :b1:E |
| R4 | boundary | administrative | 10 | 112 DE 34 | :b2:N |
| osm | class | type | admin | addr+postcode | geometry |
| R1 | boundary | administrative | 6 | 10000 | (1,2,3,4,1)|
| R34 | boundary | administrative | 8 | 11200 | (1,6,7,4,1)|
| R4 | boundary | administrative | 10 | 11230 | (1,8,9,4,1)|
And the named places
| osm | class | type | geometry |
| W93 | highway | residential | :w2N |
| W93 | highway | residential | 20,21 |
And the places
| osm | class | type | addr+postcode | geometry |
| W22 | place | postcode | 445023 | :building:w2N |
| W22 | place | postcode | 11234 | (10,11,12,13,10) |
When importing
Then place_addressline doesn't contain
| object | address |
| W93 | W22 |
Scenario: postcode boundaries do appear in the address of a way
Given the scene admin-areas
Given the grid with origin DE
| 1 | | | | | 8 | | 6 | | 2 |
| |10 |11 | | | | | | | |
| |13 |12 | | | | | | | |
| 20| | | 21| | | | | | |
| | | | | | | | | | |
| | | | | | 9 | | | | |
| 4 | | | | | | | 7 | | 3 |
And the named places
| osm | class | type | admin | addr+postcode | geometry |
| R1 | boundary | administrative | 6 | 112 | :b0 |
| R34 | boundary | administrative | 8 | 112 DE | :b1:E |
| osm | class | type | admin | addr+postcode | geometry |
| R1 | boundary | administrative | 6 | 10000 | (1,2,3,4,1) |
| R34 | boundary | administrative | 8 | 11000 | (1,6,7,4,1) |
And the places
| osm | class | type | addr+postcode | geometry |
| R4 | boundary | postal_code | 112 DE 34 | :b2:N |
| R4 | boundary | postal_code | 11200 | (1,8,9,4,1) |
And the named places
| osm | class | type | geometry |
| W93 | highway | residential | :w2N |
| W93 | highway | residential | 20,21 |
And the places
| osm | class | type | addr+postcode | geometry |
| W22 | place | postcode | 445023 | :building:w2N |
| W22 | place | postcode | 11234 | (10,11,12,13,10) |
When importing
Then place_addressline contains
| object | address |

View File

@ -21,9 +21,12 @@ Feature: Country handling
| osm | display_name |
| N1 | Wenig, Loudou |
Scenario: OSM country relations outside expected boundaries are ignored
Given the grid
| 1 | | 2 |
| 4 | | 3 |
Given the places
| osm | class | type | admin | name+name:xy | country | geometry |
| R1 | boundary | administrative | 2 | Loudou | de | poly-area:0.1 |
| R1 | boundary | administrative | 2 | Loudou | de | (1,2,3,4,1) |
Given the places
| osm | class | type | name | geometry |
| N1 | place | town | Wenig | country:de |

View File

@ -3,229 +3,261 @@ Feature: Import of address interpolations
Tests that interpolated addresses are added correctly
Scenario: Simple even interpolation line with two points
Given the grid with origin 1,1
| 1 | | 9 | | 2 |
Given the places
| osm | class | type | housenr | geometry |
| N1 | place | house | 2 | 1 1 |
| N2 | place | house | 6 | 1 1.001 |
| osm | class | type | housenr |
| N1 | place | house | 2 |
| N2 | place | house | 6 |
And the places
| osm | class | type | addr+interpolation | geometry |
| W1 | place | houses | even | 1 1, 1 1.001 |
| W1 | place | houses | even | 1,2 |
And the ways
| id | nodes |
| 1 | 1,2 |
When importing
Then W1 expands to interpolation
| start | end | geometry |
| 4 | 4 | 1 1.0005 |
| 4 | 4 | 9 |
Scenario: Backwards even two point interpolation line
Given the grid with origin 1,1
| 1 | 8 | 9 | 2 |
Given the places
| osm | class | type | housenr | geometry |
| N1 | place | house | 2 | 1 1 |
| N2 | place | house | 8 | 1 1.003 |
| osm | class | type | housenr |
| N1 | place | house | 2 |
| N2 | place | house | 8 |
And the places
| osm | class | type | addr+interpolation | geometry |
| W1 | place | houses | even | 1 1.003, 1 1 |
| W1 | place | houses | even | 1,2 |
And the ways
| id | nodes |
| 1 | 2,1 |
When importing
Then W1 expands to interpolation
| start | end | geometry |
| 4 | 6 | 1 1.001, 1 1.002 |
| 4 | 6 | 8,9 |
Scenario: Simple odd two point interpolation
Given the grid with origin 1,1
| 1 | 8 | | | 9 | 2 |
Given the places
| osm | class | type | housenr | geometry |
| N1 | place | house | 1 | 1 1 |
| N2 | place | house | 11 | 1 1.001 |
| osm | class | type | housenr |
| N1 | place | house | 1 |
| N2 | place | house | 11 |
And the places
| osm | class | type | addr+interpolation | geometry |
| W1 | place | houses | odd | 1 1, 1 1.001 |
| W1 | place | houses | odd | 1,2 |
And the ways
| id | nodes |
| 1 | 1,2 |
When importing
Then W1 expands to interpolation
| start | end | geometry |
| 3 | 9 | 1 1.0002, 1 1.0008 |
| 3 | 9 | 8,9 |
Scenario: Simple all two point interpolation
Given the grid with origin 1,1
| 1 | 8 | 9 | 2 |
Given the places
| osm | class | type | housenr | geometry |
| N1 | place | house | 1 | 1 1 |
| N2 | place | house | 4 | 1 1.003 |
| osm | class | type | housenr |
| N1 | place | house | 1 |
| N2 | place | house | 4 |
And the places
| osm | class | type | addr+interpolation | geometry |
| W1 | place | houses | all | 1 1, 1 1.003 |
| W1 | place | houses | all | 1,2 |
And the ways
| id | nodes |
| 1 | 1,2 |
When importing
Then W1 expands to interpolation
| start | end | geometry |
| 2 | 3 | 1 1.001, 1 1.002 |
| 2 | 3 | 8,9 |
Scenario: Even two point interpolation line with intermediate empty node
Given the grid
| 1 | 8 | | 3 | 9 | 2 |
Given the places
| osm | class | type | housenr | geometry |
| N1 | place | house | 2 | 1 1 |
| N2 | place | house | 10 | 1.001 1.001 |
| osm | class | type | housenr |
| N1 | place | house | 2 |
| N2 | place | house | 12 |
And the places
| osm | class | type | addr+interpolation | geometry |
| W1 | place | houses | even | 1 1, 1 1.001, 1.001 1.001 |
| W1 | place | houses | even | 1,3,2 |
And the ways
| id | nodes |
| 1 | 1,3,2 |
When importing
Then W1 expands to interpolation
| start | end | geometry |
| 4 | 8 | 1 1.0005, 1 1.001, 1.0005 1.001 |
| 4 | 10 | 8,3,9 |
Scenario: Even two point interpolation line with intermediate duplicated empty node
Given the grid
| 1 | 8 | 3 | 9 | 2 |
Given the places
| osm | class | type | housenr | geometry |
| N1 | place | house | 2 | 1 1 |
| N2 | place | house | 10 | 1.001 1.001 |
| osm | class | type | housenr |
| N1 | place | house | 2 |
| N2 | place | house | 10 |
And the places
| osm | class | type | addr+interpolation | geometry |
| W1 | place | houses | even | 1 1, 1 1.001, 1.001 1.001 |
| W1 | place | houses | even | 1,3,2 |
And the ways
| id | nodes |
| 1 | 1,3,3,2 |
When importing
Then W1 expands to interpolation
| start | end | geometry |
| 4 | 8 | 1 1.0005, 1 1.001, 1.0005 1.001 |
| 4 | 8 | 8,3,9 |
Scenario: Simple even three point interpolation line
Given the grid
| 1 | 8 | | 9 | 3 | 7 | 2 |
Given the places
| osm | class | type | housenr | geometry |
| N1 | place | house | 2 | 1 1 |
| N2 | place | house | 14 | 1.001 1.001 |
| N3 | place | house | 10 | 1 1.001 |
| osm | class | type | housenr |
| N1 | place | house | 2 |
| N2 | place | house | 14 |
| N3 | place | house | 10 |
And the places
| osm | class | type | addr+interpolation | geometry |
| W1 | place | houses | even | 1 1, 1 1.001, 1.001 1.001 |
| W1 | place | houses | even | 1,3,2 |
And the ways
| id | nodes |
| 1 | 1,3,2 |
When importing
Then W1 expands to interpolation
| start | end | geometry |
| 4 | 8 | 1 1.00025, 1 1.00075 |
| 12 | 12 | 1.0005 1.001 |
| 4 | 8 | 8,9 |
| 12 | 12 | 7 |
Scenario: Simple even four point interpolation line
Given the grid
| 1 | 10 | | 11 | 3 |
| | | | | 12|
| | | 4 | 13 | 2 |
Given the places
| osm | class | type | housenr | geometry |
| N1 | place | house | 2 | 1 1 |
| N2 | place | house | 14 | 1.001 1.001 |
| N3 | place | house | 10 | 1 1.001 |
| N4 | place | house | 18 | 1.001 1.002 |
| osm | class | type | housenr |
| N1 | place | house | 2 |
| N2 | place | house | 14 |
| N3 | place | house | 10 |
| N4 | place | house | 18 |
And the places
| osm | class | type | addr+interpolation | geometry |
| W1 | place | houses | even | 1 1, 1 1.001, 1.001 1.001, 1.001 1.002 |
| W1 | place | houses | even | 1,3,2,4 |
And the ways
| id | nodes |
| 1 | 1,3,2,4 |
When importing
Then W1 expands to interpolation
| start | end | geometry |
| 4 | 8 | 1 1.00025, 1 1.00075 |
| 12 | 12 | 1.0005 1.001 |
| 16 | 16 | 1.001 1.0015 |
| 4 | 8 | 10,11 |
| 12 | 12 | 12 |
| 16 | 16 | 13 |
Scenario: Reverse simple even three point interpolation line
Given the grid
| 1 | 8 | | 9 | 3 | 7 | 2 |
Given the places
| osm | class | type | housenr | geometry |
| N1 | place | house | 2 | 1 1 |
| N2 | place | house | 14 | 1.001 1.001 |
| N3 | place | house | 10 | 1 1.001 |
| osm | class | type | housenr |
| N1 | place | house | 2 |
| N2 | place | house | 14 |
| N3 | place | house | 10 |
And the places
| osm | class | type | addr+interpolation | geometry |
| W1 | place | houses | even | 1.001 1.001, 1 1.001, 1 1 |
| W1 | place | houses | even | 2,3,1 |
And the ways
| id | nodes |
| 1 | 2,3,1 |
When importing
Then W1 expands to interpolation
| start | end | geometry |
| 4 | 8 | 1 1.00025, 1 1.00075 |
| 12 | 12 | 1.0005 1.001 |
| 4 | 8 | 8,9 |
| 12 | 12 | 7 |
Scenario: Even three point interpolation line with odd center point
Given the grid
| 1 | | 10 | | | 11 | 3 | 2 |
Given the places
| osm | class | type | housenr | geometry |
| N1 | place | house | 2 | 1 1 |
| N2 | place | house | 8 | 1.001 1.001 |
| N3 | place | house | 7 | 1 1.001 |
| osm | class | type | housenr |
| N1 | place | house | 2 |
| N2 | place | house | 8 |
| N3 | place | house | 7 |
And the places
| osm | class | type | addr+interpolation | geometry |
| W1 | place | houses | even | 1 1, 1 1.001, 1.001 1.001 |
| W1 | place | houses | even | 1,3,2 |
And the ways
| id | nodes |
| 1 | 1,3,2 |
When importing
Then W1 expands to interpolation
| start | end | geometry |
| 4 | 6 | 1 1.0004, 1 1.0008 |
| 4 | 6 | 10,11 |
Scenario: Interpolation line with self-intersecting way
Given the grid
| 1 | 9 | 2 |
| | | 8 |
| | | 3 |
Given the places
| osm | class | type | housenr | geometry |
| N1 | place | house | 2 | 0 0 |
| N2 | place | house | 6 | 0 0.001 |
| N3 | place | house | 10 | 0 0.002 |
| osm | class | type | housenr |
| N1 | place | house | 2 |
| N2 | place | house | 6 |
| N3 | place | house | 10 |
And the places
| osm | class | type | addr+interpolation | geometry |
| W1 | place | houses | even | 0 0, 0 0.001, 0 0.002, 0 0.001 |
| W1 | place | houses | even | 1,2,3,2 |
And the ways
| id | nodes |
| 1 | 1,2,3,2 |
When importing
Then W1 expands to interpolation
| start | end | geometry |
| 4 | 4 | 0 0.0005 |
| 8 | 8 | 0 0.0015 |
| 8 | 8 | 0 0.0015 |
| 4 | 4 | 9 |
| 8 | 8 | 8 |
| 8 | 8 | 8 |
Scenario: Interpolation line with self-intersecting way II
Given the grid
| 1 | 9 | 2 |
| | | 3 |
Given the places
| osm | class | type | housenr | geometry |
| N1 | place | house | 2 | 0 0 |
| N2 | place | house | 6 | 0 0.001 |
| osm | class | type | housenr |
| N1 | place | house | 2 |
| N2 | place | house | 6 |
And the places
| osm | class | type | addr+interpolation | geometry |
| W1 | place | houses | even | 0 0, 0 0.001, 0 0.002, 0 0.001 |
| W1 | place | houses | even | 1,2,3,2 |
And the ways
| id | nodes |
| 1 | 1,2,3,2 |
When importing
Then W1 expands to interpolation
| start | end | geometry |
| 4 | 4 | 0 0.0005 |
| 4 | 4 | 9 |
Scenario: addr:street on interpolation way
Given the scene parallel-road
Given the grid
| | 1 | | 2 | |
| 10 | | | | 11 |
| 20 | | | | 21 |
And the places
| osm | class | type | housenr | geometry |
| N1 | place | house | 2 | :n-middle-w |
| N2 | place | house | 6 | :n-middle-e |
| N3 | place | house | 12 | :n-middle-w |
| N4 | place | house | 16 | :n-middle-e |
| N1 | place | house | 2 | 1 |
| N2 | place | house | 6 | 2 |
| N3 | place | house | 12 | 1 |
| N4 | place | house | 16 | 2 |
And the places
| osm | class | type | addr+interpolation | street | geometry |
| W10 | place | houses | even | | :w-middle |
| W11 | place | houses | even | Cloud Street | :w-middle |
| W10 | place | houses | even | | 1,2 |
| W11 | place | houses | even | Cloud Street | 1,2 |
And the places
| osm | class | type | name | geometry |
| W2 | highway | tertiary | Sun Way | :w-north |
| W3 | highway | tertiary | Cloud Street | :w-south |
| W2 | highway | tertiary | Sun Way | 10,11 |
| W3 | highway | tertiary | Cloud Street | 20,21 |
And the ways
| id | nodes |
| 10 | 1,100,101,102,2 |
| 11 | 3,200,201,202,4 |
| 10 | 1,2 |
| 11 | 3,4 |
When importing
Then placex contains
| object | parent_place_id |
@ -249,25 +281,28 @@ Feature: Import of address interpolations
| 0 | W | 11 |
Scenario: addr:street on housenumber way
Given the scene parallel-road
Given the grid
| | 1 | | 2 | |
| 10 | | | | 11 |
| 20 | | | | 21 |
And the places
| osm | class | type | housenr | street | geometry |
| N1 | place | house | 2 | | :n-middle-w |
| N2 | place | house | 6 | | :n-middle-e |
| N3 | place | house | 12 | Cloud Street | :n-middle-w |
| N4 | place | house | 16 | Cloud Street | :n-middle-e |
| N1 | place | house | 2 | | 1 |
| N2 | place | house | 6 | | 2 |
| N3 | place | house | 12 | Cloud Street | 1 |
| N4 | place | house | 16 | Cloud Street | 2 |
And the places
| osm | class | type | addr+interpolation | geometry |
| W10 | place | houses | even | :w-middle |
| W11 | place | houses | even | :w-middle |
| W10 | place | houses | even | 1,2 |
| W11 | place | houses | even | 1,2 |
And the places
| osm | class | type | name | geometry |
| W2 | highway | tertiary | Sun Way | :w-north |
| W3 | highway | tertiary | Cloud Street | :w-south |
| W2 | highway | tertiary | Sun Way | 10,11 |
| W3 | highway | tertiary | Cloud Street | 20,21 |
And the ways
| id | nodes |
| 10 | 1,100,101,102,2 |
| 11 | 3,200,201,202,4 |
| 10 | 1,2 |
| 11 | 3,4 |
When importing
Then placex contains
| object | parent_place_id |
@ -334,30 +369,36 @@ Feature: Import of address interpolations
When importing
Then W1 expands to no interpolation
Scenario: Ways without nodes without housenumbers are ignored
Scenario: Ways with nodes without housenumbers are ignored
Given the grid
| 1 | | 2 |
Given the places
| osm | class | type |
| N1 | place | house |
| N2 | place | house |
Given the places
| osm | class | type | housenr | geometry |
| N1 | place | house | | 1 1 |
| N2 | place | house | | 1 1.001 |
| W1 | place | houses | even | 1 1, 1 1.001 |
| W1 | place | houses | even | 1,2 |
When importing
Then W1 expands to no interpolation
Scenario: Two point interpolation starting at 0
Given the grid with origin 1,1
| 1 | 10 | | | 11 | 2 |
Given the places
| osm | class | type | housenr | geometry |
| N1 | place | house | 0 | 1 1 |
| N2 | place | house | 10 | 1 1.001 |
| osm | class | type | housenr |
| N1 | place | house | 0 |
| N2 | place | house | 10 |
And the places
| osm | class | type | addr+interpolation | geometry |
| W1 | place | houses | even | 1 1, 1 1.001 |
| W1 | place | houses | even | 1,2 |
And the ways
| id | nodes |
| 1 | 1,2 |
When importing
Then W1 expands to interpolation
| start | end | geometry |
| 2 | 8 | 1 1.0002, 1 1.0008 |
| 2 | 8 | 10,11 |
When sending jsonv2 reverse coordinates 1,1
Then results contain
| ID | osm_type | osm_id | type | display_name |

View File

@ -3,11 +3,14 @@ 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
Given the grid
| 1 | | | | 2 |
| | | 9 | | |
| 4 | | | | 3 |
And the places
| osm | class | type | name | geometry |
| R13 | landuse | forest | Garbo | :area |
| N256 | natural | peak | Garbo | :inner-C |
| R13 | landuse | forest | Garbo | (1,2,3,4,1) |
| N256 | natural | peak | Garbo | 9 |
When importing
Then placex contains
| object | linked_place_id |
@ -15,14 +18,14 @@ Feature: Linking of places
| N256 | - |
Scenario: Postcode areas cannot be linked
Given the grid
Given the grid with origin US
| 1 | | 2 |
| | 9 | |
| 4 | | 3 |
And the named places
| osm | class | type | addr+postcode | extra+wikidata | geometry |
| R13 | boundary | postal_code | 123 | Q87493 | (1,2,3,4,1) |
| N25 | place | suburb | 123 | Q87493 | 9 |
| R13 | boundary | postal_code | 12345 | Q87493 | (1,2,3,4,1) |
| N25 | place | suburb | 12345 | Q87493 | 9 |
When importing
Then placex contains
| object | linked_place_id |
@ -30,13 +33,16 @@ Feature: Linking of places
| N25 | - |
Scenario: Waterways are linked when in waterway relations
Given the scene split-road
Given the grid
| 1 | | | | 3 | 4 | | | | 6 |
| | | 2 | | | 10 | | 5 | | |
| | | | | | 11 | | | | |
And the places
| osm | class | type | name | geometry |
| W1 | waterway | river | Rhein | :w-2 |
| W2 | waterway | river | Rhein | :w-3 |
| R13 | waterway | river | Rhein | :w-1 + :w-2 + :w-3 |
| R23 | waterway | river | Limmat| :w-4a |
| W1 | waterway | river | Rhein | 1,2,3 |
| W2 | waterway | river | Rhein | 3,4,5 |
| R13 | waterway | river | Rhein | 1,2,3,4,5,6 |
| R23 | waterway | river | Limmat| 4,10,11 |
And the relations
| id | members | tags+type |
| 13 | R23:tributary,W1,W2:main_stream | waterway |
@ -53,13 +59,16 @@ Feature: Linking of places
| R |
Scenario: Relations are not linked when in waterway relations
Given the scene split-road
Given the grid
| 1 | | | | 3 | 4 | | | | 6 |
| | | 2 | | | 10 | | 5 | | |
| | | | | | 11 | | | | |
And the places
| 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 |
| W1 | waterway | stream | Rhein | 1,2,3,4 |
| W2 | waterway | river | Rhein | 4,5,6 |
| R1 | waterway | river | Rhein | 1,2,3,4 |
| R2 | waterway | river | Limmat| 4,10,11 |
And the relations
| id | members | tags+type |
| 1 | R2 | waterway |
@ -70,12 +79,19 @@ Feature: Linking of places
| W2 | - |
| R1 | - |
| R2 | - |
When sending search query "rhein"
Then results contain
| ID | osm_type |
| 0 | R |
| 1 | W |
Scenario: Empty waterway relations are handled correctly
Given the scene split-road
Given the grid
| 1 | | | | 3 |
And the places
| osm | class | type | name | geometry |
| R1 | waterway | river | Rhein | :w-1 + :w-2 + :w-3 |
| R1 | waterway | river | Rhein | 1,3 |
And the relations
| id | members | tags+type |
| 1 | | waterway |
@ -85,35 +101,36 @@ Feature: Linking of places
| R1 | - |
Scenario: Waterways are not linked when the way type is not a river feature
Given the scene split-road
Given the grid
| 1 | | 2 |
| | | |
| 3 | | 4 |
And the places
| osm | class | type | name | geometry |
| W1 | waterway | lock | Rhein | :w-2 |
| R1 | waterway | river | Rhein | :w-1 + :w-2 + :w-3 |
| W1 | waterway | lock | Rhein | 3,4 |
| R1 | landuse | meadow | Rhein | (3,1,2,4,3) |
And the relations
| id | members | tags+type |
| 1 | N23,N34,W1,R45 | multipolygon |
| id | members | tags+type |
| 1 | W1,W2 | multipolygon |
When importing
Then placex contains
| object | linked_place_id |
| W1 | - |
| R1 | - |
When sending search query "rhein"
Then results contain
| ID | osm_type |
| 0 | R |
| 1 | W |
Scenario: Side streams are linked only when they have the same name
Given the scene split-road
Given the grid
| | | | | 8 | | | |
| 1 | | 2 | 3 | | 4 | 5 | 6|
| | | | | | 9 | | |
And the places
| osm | class | type | name | geometry |
| W1 | waterway | river | Rhein2 | :w-2 |
| W2 | waterway | river | Rhein | :w-3 |
| R1 | waterway | river | Rhein | :w-1 + :w-2 + :w-3 |
| W1 | waterway | river | Rhein2 | 2,8,4 |
| W2 | waterway | river | Rhein | 3,9,5 |
| R1 | waterway | river | Rhein | 1,2,3,4,5,6 |
And the relations
| id | members | tags+type |
| 1 | W1:side_stream,W2:side_stream | waterway |
| 1 | W1:side_stream,W2:side_stream,W3 | waterway |
When importing
Then placex contains
| object | linked_place_id |
@ -126,27 +143,35 @@ Feature: Linking of places
# github #573
Scenario: Boundaries should only be linked to places
Given the 0.05 grid
| 1 | | 2 |
| | 9 | |
| 4 | | 3 |
Given the named places
| osm | class | type | extra+wikidata | admin | geometry |
| R1 | boundary | administrative | 34 | 8 | poly-area:0.1 |
| osm | class | type | extra+wikidata | admin | geometry |
| R1 | boundary | administrative | 34 | 8 | (1,2,3,4,1) |
And the named places
| osm | class | type | geometry |
| N3 | natural | island | 0.00001 0 |
| N3 | place | city | 0.00001 0 |
| osm | class | type |
| N9 | natural | island |
| N9 | place | city |
And the relations
| id | members |
| 1 | N3:label |
| 1 | N9:label |
When importing
Then placex contains
| object | linked_place_id |
| N3:natural | - |
| N3:place | R1 |
| N9:natural | - |
| N9:place | R1 |
Scenario: Nodes with 'role' label are always linked
Given the 0.05 grid
| 1 | | 2 |
| | 9 | |
| 4 | | 3 |
Given the places
| osm | class | type | admin | name | geometry |
| R13 | boundary | administrative | 6 | Garbo | poly-area:0.1 |
| N2 | place | hamlet | 15 | Vario | 0.006 0.00001 |
| osm | class | type | admin | name | geometry |
| R13 | boundary | administrative | 6 | Garbo | (1,2,3,4,1) |
| N2 | place | hamlet | 15 | Vario | 9 |
And the relations
| id | members | tags+type |
| 13 | N2:label | boundary |
@ -155,16 +180,20 @@ Feature: Linking of places
| object | linked_place_id |
| N2 | R13 |
And placex contains
| object | centroid | name+name | extratags+linked_place |
| R13 | 0.006 0.00001 | Garbo | hamlet |
| object | centroid | name+name | extratags+linked_place |
| R13 | 9 | Garbo | hamlet |
Scenario: Boundaries with place tags are linked against places with same type
Given the 0.01 grid
| 1 | | 2 |
| | 9 | |
| 4 | | 3 |
Given the places
| osm | class | type | admin | name | extra+place | geometry |
| R13 | boundary | administrative | 4 | Berlin | city |poly-area:0.1 |
| osm | class | type | admin | name | extra+place | geometry |
| R13 | boundary | administrative | 4 | Berlin | city | (1,2,3,4,1) |
And the places
| osm | class | type | name | geometry |
| N2 | place | city | Berlin | 0.006 0.00001 |
| N2 | place | city | Berlin | 9 |
When importing
Then placex contains
| object | linked_place_id |
@ -187,12 +216,16 @@ Feature: Linking of places
Scenario: Boundaries without place tags only link against same admin level
Given the 0.05 grid
| 1 | | 2 |
| | 9 | |
| 4 | | 3 |
Given the places
| osm | class | type | admin | name | geometry |
| R13 | boundary | administrative | 4 | Berlin |poly-area:0.1 |
| R13 | boundary | administrative | 4 | Berlin | (1,2,3,4,1) |
And the places
| osm | class | type | name | geometry |
| N2 | place | city | Berlin | 0.006 0.00001 |
| N2 | place | city | Berlin | 9 |
When importing
Then placex contains
| object | linked_place_id |
@ -215,12 +248,16 @@ Feature: Linking of places
# github #1352
Scenario: Do not use linked centroid when it is outside the area
Given the 0.05 grid
| 1 | | 2 | |
| | | | 9 |
| 4 | | 3 | |
Given the named places
| osm | class | type | admin | geometry |
| R13 | boundary | administrative | 4 | poly-area:0.01 |
| R13 | boundary | administrative | 4 | (1,2,3,4,1) |
And the named places
| osm | class | type | geometry |
| N2 | place | city | 0.1 0.1 |
| N2 | place | city | 9 |
And the relations
| id | members | tags+type |
| 13 | N2:label | boundary |
@ -233,13 +270,17 @@ Feature: Linking of places
| R13 | in geometry |
Scenario: Place nodes can only be linked once
Given the 0.02 grid
| 1 | | 2 | | 5 |
| | 9 | | | |
| 4 | | 3 | | 6 |
Given the named places
| osm | class | type | extra+wikidata | geometry |
| N2 | place | city | Q1234 | 0 0 |
| N2 | place | city | Q1234 | 9 |
And the named places
| osm | class | type | extra+wikidata | admin | geometry |
| R1 | boundary | administrative | Q1234 | 8 | poly-area:0.1 |
| R2 | boundary | administrative | Q1234 | 9 | poly-area:0.01 |
| osm | class | type | extra+wikidata | admin | geometry |
| R1 | boundary | administrative | Q1234 | 8 | (1,2,5,6,3,4,1) |
| R2 | boundary | administrative | Q1234 | 9 | (1,2,3,4,1) |
When importing
Then placex contains
| object | linked_place_id |

View File

@ -3,16 +3,19 @@ Feature: Parenting of objects
Tests that the correct parent is chosen
Scenario: Address inherits postcode from its street unless it has a postcode
Given the scene roads-with-pois
Given the grid with origin DE
| 10 | | | | | 11 |
| | | | | | |
| | 1 | | 2 | | |
And the places
| osm | class | type | housenr | geometry |
| N1 | place | house | 4 | :p-N1 |
| osm | class | type | housenr |
| N1 | place | house | 4 |
And the places
| osm | class | type | housenr | postcode | geometry |
| N2 | place | house | 5 | 99999 | :p-N1 |
| osm | class | type | housenr | postcode |
| N2 | place | house | 5 | 99999 |
And the places
| osm | class | type | name | postcode | geometry |
| W1 | highway | residential | galoo | 12345 | :w-north |
| W1 | highway | residential | galoo | 12345 | 10,11 |
When importing
Then placex contains
| object | parent_place_id |
@ -21,24 +24,28 @@ Feature: Parenting of objects
When sending search query "4 galoo"
Then results contain
| ID | osm_type | osm_id | display_name |
| 0 | N | 1 | 4, galoo, 12345 |
| 0 | N | 1 | 4, galoo, 12345, Deutschland |
When sending search query "5 galoo"
Then results contain
| ID | osm_type | osm_id | display_name |
| 0 | N | 2 | 5, galoo, 99999 |
| 0 | N | 2 | 5, galoo, 99999, Deutschland |
Scenario: Address without tags, closest street
Given the scene roads-with-pois
Given the grid
| 10 | | | | | 11 |
| | 1 | 2 | | | |
| | | | 3 | 4 | |
| 20 | | | | | 21 |
And the places
| osm | class | type | geometry |
| N1 | place | house | :p-N1 |
| N2 | place | house | :p-N2 |
| N3 | place | house | :p-S1 |
| N4 | place | house | :p-S2 |
| osm | class | type |
| N1 | place | house |
| N2 | place | house |
| N3 | place | house |
| N4 | place | house |
And the named places
| osm | class | type | geometry |
| W1 | highway | residential | :w-north |
| W2 | highway | residential | :w-south |
| W1 | highway | residential | 10,11 |
| W2 | highway | residential | 20,21 |
When importing
Then placex contains
| object | parent_place_id |
@ -48,17 +55,23 @@ Feature: Parenting of objects
| N4 | W2 |
Scenario: Address without tags avoids unnamed streets
Given the scene roads-with-pois
Given the grid
| 10 | | | | | 11 |
| | 1 | 2 | | | |
| | | | 3 | 4 | |
| 20 | | | | | 21 |
And the places
| osm | class | type | geometry |
| N1 | place | house | :p-N1 |
| N2 | place | house | :p-N2 |
| N3 | place | house | :p-S1 |
| N4 | place | house | :p-S2 |
| W1 | highway | residential | :w-north |
| osm | class | type |
| N1 | place | house |
| N2 | place | house |
| N3 | place | house |
| N4 | place | house |
And the places
| osm | class | type | geometry |
| W1 | highway | residential | 10,11 |
And the named places
| osm | class | type | geometry |
| W2 | highway | residential | :w-south |
| W2 | highway | residential | 20,21 |
When importing
Then placex contains
| object | parent_place_id |
@ -68,17 +81,21 @@ Feature: Parenting of objects
| N4 | W2 |
Scenario: addr:street tag parents to appropriately named street
Given the scene roads-with-pois
Given the grid
| 10 | | | | | 11 |
| | 1 | 2 | | | |
| | | | 3 | 4 | |
| 20 | | | | | 21 |
And the places
| osm | class | type | street| geometry |
| N1 | place | house | south | :p-N1 |
| N2 | place | house | north | :p-N2 |
| N3 | place | house | south | :p-S1 |
| N4 | place | house | north | :p-S2 |
| osm | class | type | street|
| N1 | place | house | south |
| N2 | place | house | north |
| N3 | place | house | south |
| N4 | place | house | north |
And the places
| osm | class | type | name | geometry |
| W1 | highway | residential | north | :w-north |
| W2 | highway | residential | south | :w-south |
| W1 | highway | residential | north | 10,11 |
| W2 | highway | residential | south | 20,21 |
When importing
Then placex contains
| object | parent_place_id |
@ -89,20 +106,21 @@ Feature: Parenting of objects
@fail-legacy
Scenario: addr:street tag parents to appropriately named street, locale names
Given the scene roads-with-pois
Given the grid
| 10 | | | | | 11 |
| | 1 | 2 | | | |
| | | | 3 | 4 | |
| 20 | | | | | 21 |
And the places
| osm | class | type | street| addr+street:de | geometry |
| N1 | place | house | south | Süd | :p-N1 |
| N2 | place | house | north | Nord | :p-N2 |
| N3 | place | house | south | Süd | :p-S1 |
| N4 | place | house | north | Nord | :p-S2 |
| osm | class | type | street| addr+street:de |
| N1 | place | house | south | Süd |
| N2 | place | house | north | Nord |
| N3 | place | house | south | Süd |
| N4 | place | house | north | Nord |
And the places
| osm | class | type | name | geometry |
| W1 | highway | residential | Nord | :w-north |
| W2 | highway | residential | Süd | :w-south |
And the places
| osm | class | type | name | name+name:old |
| N5 | place | hamlet | south | north |
| W1 | highway | residential | Nord | 10,11 |
| W2 | highway | residential | Süd | 20,21 |
When importing
Then placex contains
| object | parent_place_id |
@ -112,17 +130,21 @@ Feature: Parenting of objects
| N4 | W1 |
Scenario: addr:street tag parents to appropriately named street with abbreviation
Given the scene roads-with-pois
Given the grid
| 10 | | | | | 11 |
| | 1 | 2 | | | |
| | | | 3 | 4 | |
| 20 | | | | | 21 |
And the places
| osm | class | type | street| geometry |
| N1 | place | house | south st | :p-N1 |
| N2 | place | house | north st | :p-N2 |
| N3 | place | house | south st | :p-S1 |
| N4 | place | house | north st | :p-S2 |
| osm | class | type | street |
| N1 | place | house | south st |
| N2 | place | house | north st |
| N3 | place | house | south st |
| N4 | place | house | north st |
And the places
| osm | class | type | name+name:en | geometry |
| W1 | highway | residential | north street | :w-north |
| W2 | highway | residential | south street | :w-south |
| osm | class | type | name+name:en | geometry |
| W1 | highway | residential | north street | 10,11 |
| W2 | highway | residential | south street | 20,21 |
When importing
Then placex contains
| object | parent_place_id |
@ -131,20 +153,22 @@ Feature: Parenting of objects
| N3 | W2 |
| N4 | W1 |
Scenario: addr:street tag parents to next named street
Given the scene roads-with-pois
Given the grid
| 10 | | | | | 11 |
| | 1 | 2 | | | |
| | | | 3 | 4 | |
| 20 | | | | | 21 |
And the places
| osm | class | type | street | geometry |
| N1 | place | house | abcdef | :p-N1 |
| N2 | place | house | abcdef | :p-N2 |
| N3 | place | house | abcdef | :p-S1 |
| N4 | place | house | abcdef | :p-S2 |
| osm | class | type | street |
| N1 | place | house | abcdef |
| N2 | place | house | abcdef |
| N3 | place | house | abcdef |
| N4 | place | house | abcdef |
And the places
| osm | class | type | name | geometry |
| W1 | highway | residential | abcdef | :w-north |
| W2 | highway | residential | abcdef | :w-south |
| W1 | highway | residential | abcdef | 10,11 |
| W2 | highway | residential | abcdef | 20,21 |
When importing
Then placex contains
| object | parent_place_id |
@ -154,64 +178,74 @@ Feature: Parenting of objects
| N4 | W2 |
Scenario: addr:street tag without appropriately named street
Given the scene roads-with-pois
Given the grid
| 10 | | | | | 11 |
| | 1 | | | | |
| | | | 3 | | |
| 20 | | | | | 21 |
And the places
| osm | class | type | street | geometry |
| N1 | place | house | abcdef | :p-N1 |
| N2 | place | house | abcdef | :p-N2 |
| N3 | place | house | abcdef | :p-S1 |
| N4 | place | house | abcdef | :p-S2 |
| osm | class | type | street |
| N1 | place | house | abcdef |
| N3 | place | house | abcdef |
And the places
| osm | class | type | name | geometry |
| W1 | highway | residential | abcde | :w-north |
| W2 | highway | residential | abcde | :w-south |
| W1 | highway | residential | abcde | 10,11 |
| W2 | highway | residential | abcde | 20,21 |
When importing
Then placex contains
| object | parent_place_id |
| N1 | W1 |
| N2 | W1 |
| N3 | W2 |
| N4 | W2 |
Scenario: addr:place address
Given the scene road-with-alley
Given the grid
| 10 | | | |
| | 1 | | 2 |
| 11 | | | |
And the places
| osm | class | type | addr_place | geometry |
| N1 | place | house | myhamlet | :n-alley |
| osm | class | type | addr_place |
| N1 | place | house | myhamlet |
And the places
| osm | class | type | name | geometry |
| N2 | place | hamlet | myhamlet | :n-main-west |
| W1 | highway | residential | myhamlet | :w-main |
| N2 | place | hamlet | myhamlet | 2 |
| W1 | highway | residential | myhamlet | 10,11 |
When importing
Then placex contains
| object | parent_place_id |
| N1 | N2 |
Scenario: addr:street is preferred over addr:place
Given the scene road-with-alley
Given the grid
| 10 | | | |
| | | 1 | 2 |
| 11 | | | |
And the places
| osm | class | type | addr_place | street | geometry |
| N1 | place | house | myhamlet | mystreet| :n-alley |
| osm | class | type | addr_place | street |
| N1 | place | house | myhamlet | mystreet|
And the places
| osm | class | type | name | geometry |
| N2 | place | hamlet | myhamlet | :n-main-west |
| W1 | highway | residential | mystreet | :w-main |
| N2 | place | hamlet | myhamlet | 2 |
| W1 | highway | residential | mystreet | 10,11 |
When importing
Then placex contains
| object | parent_place_id |
| N1 | W1 |
Scenario: Untagged address in simple associated street relation
Given the scene road-with-alley
Given the grid
| 10 | | | | | 11 |
| | 2 | | 3 | | |
| | | | | | |
| 12 | 1 | | | | |
And the places
| osm | class | type | geometry |
| N1 | place | house | :n-alley |
| N2 | place | house | :n-corner |
| N3 | place | house | :n-main-west |
| osm | class | type |
| N1 | place | house |
| N2 | place | house |
| N3 | place | house |
And the places
| osm | class | type | name | geometry |
| W1 | highway | residential | foo | :w-main |
| W2 | highway | service | bar | :w-alley |
| W1 | highway | residential | foo | 10,11 |
| W2 | highway | service | bar | 10,12 |
And the relations
| id | members | tags+type |
| 1 | W1:street,N1,N2,N3 | associatedStreet |
@ -223,16 +257,22 @@ Feature: Parenting of objects
| N3 | W1 |
Scenario: Avoid unnamed streets in simple associated street relation
Given the scene road-with-alley
Given the grid
| 10 | | | | | 11 |
| | 2 | | 3 | | |
| | | | | | |
| 12 | 1 | | | | |
And the places
| osm | class | type | geometry |
| N1 | place | house | :n-alley |
| N2 | place | house | :n-corner |
| N3 | place | house | :n-main-west |
| W2 | highway | residential | :w-alley |
| osm | class | type |
| N1 | place | house |
| N2 | place | house |
| N3 | place | house |
And the places
| osm | class | type | geometry |
| W2 | highway | residential | 10,12 |
And the named places
| osm | class | type | geometry |
| W1 | highway | residential | :w-main |
| W1 | highway | residential | 10,11 |
And the relations
| id | members | tags+type |
| 1 | N1,N2,N3,W2:street,W1:street | associatedStreet |
@ -244,89 +284,107 @@ Feature: Parenting of objects
| N3 | W1 |
Scenario: Associated street relation overrides addr:street
Given the scene road-with-alley
Given the grid
| 10 | | | | 11 |
| | | | | |
| | | 1 | | |
| | 20 | | 21 | |
And the places
| osm | class | type | street | geometry |
| N1 | place | house | bar | :n-alley |
| osm | class | type | street |
| N1 | place | house | bar |
And the places
| osm | class | type | name | geometry |
| W1 | highway | residential | foo | :w-main |
| W2 | highway | residential | bar | :w-alley |
| W1 | highway | residential | foo | 10,11 |
| W2 | highway | residential | bar | 20,21 |
And the relations
| id | members | tags+type |
| 1 | W1:street,N1,N2,N3 | associatedStreet |
| id | members | tags+type |
| 1 | W1:street,N1 | associatedStreet |
When importing
Then placex contains
| object | parent_place_id |
| N1 | W1 |
Scenario: Building without tags, closest street from center point
Given the scene building-on-street-corner
Given the grid
| 10 | | | | 11 |
| | | 1 | 2 | |
| 12 | | 4 | 3 | |
And the named places
| osm | class | type | geometry |
| W1 | building | yes | :w-building |
| W2 | highway | primary | :w-WE |
| W3 | highway | residential | :w-NS |
| osm | class | type | geometry |
| W1 | building | yes | (1,2,3,4,1) |
| W2 | highway | primary | 10,11 |
| W3 | highway | residential | 10,12 |
When importing
Then placex contains
| object | parent_place_id |
| W1 | W2 |
Scenario: Building with addr:street tags
Given the scene building-on-street-corner
Given the grid
| 10 | | | | 11 |
| | | 1 | 2 | |
| 12 | | 4 | 3 | |
And the named places
| osm | class | type | street | geometry |
| W1 | building | yes | bar | :w-building |
| W1 | building | yes | foo | (1,2,3,4,1) |
And the places
| osm | class | type | name | geometry |
| W2 | highway | primary | bar | :w-WE |
| W3 | highway | residential | foo | :w-NS |
| W2 | highway | primary | bar | 10,11 |
| W3 | highway | residential | foo | 10,12 |
When importing
Then placex contains
| object | parent_place_id |
| W1 | W2 |
| W1 | W3 |
Scenario: Building with addr:place tags
Given the scene building-on-street-corner
Given the grid
| 10 | | | | |
| | 1 | 2 | | 9 |
| 11 | 4 | 3 | | |
And the places
| osm | class | type | name | geometry |
| N1 | place | village | bar | :n-outer |
| W2 | highway | primary | bar | :w-WE |
| W3 | highway | residential | foo | :w-NS |
| N9 | place | village | bar | 9 |
| W2 | highway | primary | bar | 10,11 |
And the named places
| osm | class | type | addr_place | geometry |
| W1 | building | yes | bar | :w-building |
| osm | class | type | addr_place | geometry |
| W1 | building | yes | bar | (1,2,3,4,1) |
When importing
Then placex contains
| object | parent_place_id |
| W1 | N1 |
| W1 | N9 |
Scenario: Building in associated street relation
Given the scene building-on-street-corner
Given the grid
| 10 | | | | 11 |
| | | 1 | 2 | |
| 12 | | 4 | 3 | |
And the named places
| osm | class | type | geometry |
| W1 | building | yes | :w-building |
| osm | class | type | geometry |
| W1 | building | yes | (1,2,3,4,1) |
And the places
| osm | class | type | name | geometry |
| W2 | highway | primary | bar | :w-WE |
| W3 | highway | residential | foo | :w-NS |
| W2 | highway | primary | bar | 10,11 |
| W3 | highway | residential | foo | 10,12 |
And the relations
| id | members | tags+type |
| 1 | W1:house,W2:street | associatedStreet |
| 1 | W1:house,W3:street | associatedStreet |
When importing
Then placex contains
| object | parent_place_id |
| W1 | W2 |
| W1 | W3 |
Scenario: Building in associated street relation overrides addr:street
Given the scene building-on-street-corner
Given the grid
| 10 | | | | 11 |
| | | 1 | 2 | |
| 12 | | 4 | 3 | |
And the named places
| osm | class | type | street | geometry |
| W1 | building | yes | foo | :w-building |
| osm | class | type | street | geometry |
| W1 | building | yes | foo | (1,2,3,4,1) |
And the places
| osm | class | type | name | geometry |
| W2 | highway | primary | bar | :w-WE |
| W3 | highway | residential | foo | :w-NS |
| W2 | highway | primary | bar | 10,11 |
| W3 | highway | residential | foo | 10,12 |
And the relations
| id | members | tags+type |
| 1 | W1:house,W2:street | associatedStreet |
@ -336,17 +394,19 @@ Feature: Parenting of objects
| W1 | W2 |
Scenario: Wrong member in associated street relation is ignored
Given the scene building-on-street-corner
And the named places
Given the grid
| 10 | | | | | | | 11 |
| | 1 | | 3 | 4 | | | |
| | | | 6 | 5 | | | |
And the named places
| osm | class | type | geometry |
| N1 | place | house | :n-outer |
| N1 | place | house | 11 |
And the named places
| osm | class | type | street | geometry |
| W1 | building | yes | foo | :w-building |
| osm | class | type | street | geometry |
| W1 | building | yes | foo | (3,4,5,6,3) |
And the places
| osm | class | type | name | geometry |
| W2 | highway | primary | bar | :w-WE |
| W3 | highway | residential | foo | :w-NS |
| W3 | highway | residential | foo | 10,11 |
And the relations
| id | members | tags+type |
| 1 | N1:house,W1:street,W3:street | associatedStreet |
@ -355,7 +415,6 @@ Feature: Parenting of objects
| object | parent_place_id |
| N1 | W3 |
Scenario: street member in associatedStreet relation can be a relation
Given the grid
| 1 | | | 2 |
@ -379,19 +438,23 @@ Feature: Parenting of objects
| N9 | R14 |
Scenario: POIs in building inherit address
Given the scene building-on-street-corner
Given the grid
| 10 | | | | | | 11 |
| | | 5 | 2 | 6 | | |
| | | 3 | 1 | | | |
| 12 | | 8 | | 7 | | |
And the named places
| osm | class | type | geometry |
| N1 | amenity | bank | :n-inner |
| N2 | shop | bakery | :n-edge-NS |
| N3 | shop | supermarket| :n-edge-WE |
| osm | class | type |
| N1 | amenity | bank |
| N2 | shop | bakery |
| N3 | shop | supermarket|
And the places
| osm | class | type | street | addr_place | housenr | geometry |
| W1 | building | yes | foo | nowhere | 3 | :w-building |
| osm | class | type | street | housenr | geometry |
| W1 | building | yes | foo | 3 | (5,6,7,8,5) |
And the places
| osm | class | type | name | geometry |
| W2 | highway | primary | bar | :w-WE |
| W3 | highway | residential | foo | :w-NS |
| W2 | highway | primary | bar | 10,11 |
| W3 | highway | residential | foo | 10,12 |
When importing
Then placex contains
| object | parent_place_id | housenumber |
@ -405,115 +468,127 @@ Feature: Parenting of objects
| 3 |
Scenario: POIs don't inherit from streets
Given the scene building-on-street-corner
Given the grid
| 10 | | | | 11 |
| | 5 | 1 | 6 | |
| | 8 | | 7 | |
And the named places
| osm | class | type | geometry |
| N1 | amenity | bank | :n-inner |
| osm | class | type |
| N1 | amenity | bank |
And the places
| osm | class | type | street | addr_place | housenr | geometry |
| W1 | highway | path | foo | nowhere | 3 | :w-building |
| osm | class | type | name | street | housenr | geometry |
| W1 | highway | path | bar | foo | 3 | (5,6,7,8,5) |
And the places
| osm | class | type | name | geometry |
| W3 | highway | residential | foo | :w-NS |
| W3 | highway | residential | foo | 10,11 |
When importing
Then placex contains
| object | parent_place_id | housenumber |
| N1 | W3 | None |
| N1 | W1 | None |
Scenario: POIs with own address do not inherit building address
Given the scene building-on-street-corner
Given the grid
| 10 | | | | | | 11 |
| | | 6 | 2 | 7 | | |
| | | 3 | 1 | | 5 | 4 |
| 12 | | 9 | | 8 | | |
And the named places
| osm | class | type | street | geometry |
| N1 | amenity | bank | bar | :n-inner |
| osm | class | type | street |
| N1 | amenity | bank | bar |
And the named places
| osm | class | type | housenr | geometry |
| N2 | shop | bakery | 4 | :n-edge-NS |
| osm | class | type | housenr |
| N2 | shop | bakery | 4 |
And the named places
| osm | class | type | addr_place | geometry |
| N3 | shop | supermarket| nowhere | :n-edge-WE |
| osm | class | type | addr_place |
| N3 | shop | supermarket| nowhere |
And the places
| osm | class | type | name | geometry |
| N4 | place | isolated_dwelling | theplace | :n-outer |
| osm | class | type | name |
| N4 | place | isolated_dwelling | theplace |
| N5 | place | isolated_dwelling | nowhere |
And the places
| osm | class | type | addr_place | housenr | geometry |
| W1 | building | yes | theplace | 3 | :w-building |
| osm | class | type | addr_place | housenr | geometry |
| W1 | building | yes | theplace | 3 | (6,7,8,9,6) |
And the places
| osm | class | type | name | geometry |
| W2 | highway | primary | bar | :w-WE |
| W3 | highway | residential | foo | :w-NS |
| W2 | highway | primary | bar | 10,11 |
| W3 | highway | residential | foo | 10,12 |
When importing
Then placex contains
| object | parent_place_id | housenumber |
| W1 | N4 | 3 |
| N1 | W2 | None |
| N2 | W3 | 4 |
| N3 | N4 | None |
| N2 | W2 | 4 |
| N3 | N5 | None |
Scenario: POIs parent a road if they are attached to it
Given the scene points-on-roads
Given the grid
| | 10 | |
| 20 | 1 | 21 |
| | 11 | |
And the named places
| osm | class | type | street | geometry |
| N1 | highway | bus_stop | North St | :n-SE |
| N2 | highway | bus_stop | South St | :n-NW |
| N3 | highway | bus_stop | North St | :n-S-unglued |
| N4 | highway | bus_stop | South St | :n-N-unglued |
| osm | class | type |
| N1 | highway | bus_stop |
And the places
| osm | class | type | name | geometry |
| W1 | highway | secondary | North St | :w-north |
| W2 | highway | unclassified | South St | :w-south |
| W1 | highway | secondary | North St | 10,11 |
| W2 | highway | unclassified | South St | 20,1,21 |
And the ways
| id | nodes |
| 1 | 100,101,2,103,104 |
| 2 | 200,201,1,202,203 |
When importing
Then placex contains
| object | parent_place_id |
| N1 | W1 |
| N2 | W2 |
| N3 | W1 |
| N4 | W2 |
Scenario: POIs do not parent non-roads they are attached to
Given the scene points-on-roads
And the named places
| osm | class | type | street | geometry |
| N1 | highway | bus_stop | North St | :n-SE |
| N2 | highway | bus_stop | South St | :n-NW |
And the places
| osm | class | type | name | geometry |
| W1 | landuse | residential | North St | :w-north |
| W2 | waterway| river | South St | :w-south |
And the ways
| id | nodes |
| 1 | 100,101,2,103,104 |
| 2 | 200,201,1,202,203 |
When importing
Then placex contains
| object | parent_place_id |
| N1 | 0 |
| N2 | 0 |
Scenario: POIs on building outlines inherit associated street relation
Given the scene building-on-street-corner
And the named places
| osm | class | type | geometry |
| N1 | place | house | :n-edge-NS |
| W1 | building | yes | :w-building |
And the places
| osm | class | type | name | geometry |
| W2 | highway | primary | bar | :w-WE |
| W3 | highway | residential | foo | :w-NS |
And the relations
| id | members | tags+type |
| 1 | W1:house,W2:street | associatedStreet |
And the ways
| id | nodes |
| 1 | 100,1,101,102,100 |
| 1 | 10,11 |
| 2 | 20,1,21 |
When importing
Then placex contains
| object | parent_place_id |
| N1 | W2 |
Scenario: POIs do not parent non-roads they are attached to
Given the grid
| 10 | | 1 | | 11 | | 30 |
| 14 | | | | 15 | | |
| 13 | | 2 | | 12 | | 31 |
And the named places
| osm | class | type | street |
| N1 | highway | bus_stop | North St |
| N2 | highway | bus_stop | South St |
And the places
| osm | class | type | name | geometry |
| W1 | landuse | residential | North St | (14,15,12,2,13,14) |
| W2 | waterway| river | South St | 10,1,11 |
| W3 | highway | residential | foo | 30,31 |
And the ways
| id | nodes |
| 1 | 10,11,12,2,13,10 |
| 2 | 10,1,11 |
When importing
Then placex contains
| object | parent_place_id |
| N1 | W3 |
| N2 | W3 |
Scenario: POIs on building outlines inherit associated street relation
Given the grid
| 10 | | | | 11 |
| | 5 | 1 | 6 | |
| 12 | 8 | | 7 | |
And the named places
| osm | class | type | geometry |
| N1 | place | house | 1 |
| W1 | building | yes | (5,1,6,7,8,5)|
And the places
| osm | class | type | name | geometry |
| W2 | highway | primary | bar | 10,11 |
| W3 | highway | residential | foo | 10,12 |
And the relations
| id | members | tags+type |
| 1 | W1:house,W3:street | associatedStreet |
And the ways
| id | nodes |
| 1 | 5,1,6,7,8,5 |
When importing
Then placex contains
| object | parent_place_id |
| N1 | W3 |
# github #1056
Scenario: Full names should be preferably matched for nearest road
Given the grid

View File

@ -55,9 +55,12 @@ Feature: Import into placex
Then placex has no entry for N1
Scenario: postcode boundary without postcode is dropped
Given the 0.01 grid
| 1 | 2 |
| 3 | |
Given the places
| osm | class | type | name+ref | geometry |
| R1 | boundary | postal_code | 554476 | poly-area:0.1 |
| osm | class | type | name+ref | geometry |
| R1 | boundary | postal_code | 554476 | (1,2,3,1) |
When importing
Then placex has no entry for R1
@ -91,18 +94,19 @@ Feature: Import into placex
| R41 | 8 | 0 |
Scenario: search and address ranks for highways correctly assigned
Given the scene roads-with-pois
Given the grid
| 10 | 1 | 11 | | 12 | | 13 | | 14 | | 15 | | 16 |
And the places
| osm | class | type |
| N1 | highway | bus_stop |
And the places
| osm | class | type | geometry |
| W1 | highway | primary | :w-south |
| W2 | highway | secondary | :w-south |
| W3 | highway | tertiary | :w-south |
| W4 | highway | residential | :w-north |
| W5 | highway | unclassified | :w-north |
| W6 | highway | something | :w-north |
| W1 | highway | primary | 10,11 |
| W2 | highway | secondary | 11,12 |
| W3 | highway | tertiary | 12,13 |
| W4 | highway | residential | 13,14 |
| W5 | highway | unclassified | 14,15 |
| W6 | highway | something | 15,16 |
When importing
Then placex contains
| object | rank_search | rank_address |
@ -115,15 +119,18 @@ Feature: Import into placex
| W6 | 30 | 30 |
Scenario: rank and inclusion of landuses
Given the 0.4 grid
| 1 | 2 | | | | | | 5 |
| 4 | 3 | | | | | | 6 |
Given the named places
| osm | class | type |
| N2 | landuse | residential |
And the named places
| osm | class | type | geometry |
| W2 | landuse | residential | 1 1, 1 1.1 |
| W4 | landuse | residential | poly-area:0.1 |
| R2 | landuse | residential | poly-area:0.05 |
| R3 | landuse | forrest | poly-area:0.5 |
| osm | class | type | geometry |
| W2 | landuse | residential | 1,2,5 |
| W4 | landuse | residential | (1,4,3,1) |
| R2 | landuse | residential | (1,2,3,4,1) |
| R3 | landuse | forrest | (1,5,6,4,1) |
When importing
Then placex contains
| object | rank_search | rank_address |
@ -134,19 +141,22 @@ Feature: Import into placex
| R3 | 22 | 0 |
Scenario: rank and inclusion of naturals
Given the 0.4 grid
| 1 | 2 | | | | | | 5 |
| 4 | 3 | | | | | | 6 |
Given the named places
| osm | class | type |
| N2 | natural | peak |
| N4 | natural | volcano |
| N5 | natural | foobar |
And the named places
| osm | class | type | geometry |
| W2 | natural | mountain_range | 12 12,11 11 |
| W3 | natural | foobar | 13 13,13.1 13 |
| R3 | natural | volcano | poly-area:0.1 |
| R4 | natural | foobar | poly-area:0.5 |
| R5 | natural | sea | poly-area:5.0 |
| R6 | natural | sea | poly-area:0.01 |
| osm | class | type | geometry |
| W2 | natural | mountain_range | 1,2,5 |
| W3 | natural | foobar | 2,3 |
| R3 | natural | volcano | (1,2,4,1) |
| R4 | natural | foobar | (1,2,3,4,1) |
| R5 | natural | sea | (1,2,5,6,3,4,1) |
| R6 | natural | sea | (2,3,4,2) |
When importing
Then placex contains
| object | rank_search | rank_address |
@ -161,16 +171,19 @@ Feature: Import into placex
| W3 | 22 | 0 |
Scenario: boundary ways for countries and states are ignored
Given the 0.3 grid
| 1 | 2 |
| 4 | 3 |
Given the named places
| osm | class | type | admin | geometry |
| W4 | boundary | administrative | 2 | poly-area:0.1 |
| R4 | boundary | administrative | 2 | poly-area:0.1 |
| W5 | boundary | administrative | 3 | poly-area:0.1 |
| R5 | boundary | administrative | 3 | poly-area:0.1 |
| W6 | boundary | administrative | 4 | poly-area:0.1 |
| R6 | boundary | administrative | 4 | poly-area:0.1 |
| W7 | boundary | administrative | 5 | poly-area:0.1 |
| R7 | boundary | administrative | 5 | poly-area:0.1 |
| W4 | boundary | administrative | 2 | (1,2,3,4,1) |
| R4 | boundary | administrative | 2 | (1,2,3,4,1) |
| W5 | boundary | administrative | 3 | (1,2,3,4,1) |
| R5 | boundary | administrative | 3 | (1,2,3,4,1) |
| W6 | boundary | administrative | 4 | (1,2,3,4,1) |
| R6 | boundary | administrative | 4 | (1,2,3,4,1) |
| W7 | boundary | administrative | 5 | (1,2,3,4,1) |
| R7 | boundary | administrative | 5 | (1,2,3,4,1) |
When importing
Then placex contains exactly
| object |

View File

@ -3,128 +3,155 @@ Feature: Import of postcodes
Tests for postcode estimation
Scenario: Postcodes on the object are preferred over those on the address
Given the scene admin-areas
Given the grid with origin FR
| 1 | | | | 4 | | 6 | | 8 |
| | 10 | | 11 | | | | | |
| | | 22 | | | | | | |
| 2 | | | | 3 | | 5 | | 7 |
And the named places
| osm | class | type | admin | addr+postcode | geometry |
| R1 | boundary | administrative | 6 | 112 | :b0 |
| R34 | boundary | administrative | 8 | 112 DE | :b1:E |
| R4 | boundary | administrative | 10 | 112 DE 34 | :b2:N |
| osm | class | type | admin | addr+postcode | geometry |
| R1 | boundary | administrative | 6 | 10000 | (1,8,7,2,1) |
| R34 | boundary | administrative | 8 | 11000 | (1,6,5,2,1) |
| R4 | boundary | administrative | 10 | 11200 | (1,4,3,2,1) |
And the named places
| osm | class | type | addr+postcode | geometry |
| W93 | highway | residential | 112 DE 344 | :w2N |
| W22 | building | yes | 112 DE 344N | :building:w2N |
| W93 | highway | residential | 11250 | 10,11 |
| N22 | building | yes | 11254 | 22 |
When importing
Then placex contains
| object | postcode |
| W22 | 112 DE 344N |
| W93 | 112 DE 344 |
| R4 | 112 DE 34 |
| R34 | 112 DE |
| R1 | 112 |
| object | postcode |
| N22 | 11254 |
| W93 | 11250 |
| R4 | 11200 |
| R34 | 11000 |
| R1 | 10000 |
Scenario: Postcodes from a road are inherited by an attached building
Given the scene admin-areas
Given the grid with origin DE
| 10 | | | | 11 |
| | 1 | 2 | | |
| | 4 | 3 | | |
And the named places
| osm | class | type | addr+postcode | geometry |
| W93 | highway | residential | 86034 | :w2N |
| W93 | highway | residential | 86034 | 10,11 |
And the named places
| osm | class | type | geometry |
| W22 | building | yes | :building:w2N |
| osm | class | type | geometry |
| W22 | building | yes | (1,2,3,4,1) |
When importing
Then placex contains
| object | postcode | parent_place_id |
| W22 | 86034 | W93 |
Scenario: Postcodes from the lowest admin area are inherited by ways
Given the scene admin-areas
Given the grid with origin FR
| 1 | | | | 4 | | 6 | | 8 |
| | 10 | | 11 | | | | | |
| 2 | | | | 3 | | 5 | | 7 |
And the named places
| osm | class | type | admin | addr+postcode | geometry |
| R1 | boundary | administrative | 6 | 112 | :b0 |
| R34 | boundary | administrative | 8 | 112 DE | :b1:E |
| R4 | boundary | administrative | 10 | 112 DE 34 | :b2:N |
| R1 | boundary | administrative | 6 | 10000 | (1,8,7,2,1) |
| R34 | boundary | administrative | 8 | 11000 | (1,6,5,2,1) |
| R4 | boundary | administrative | 10 | 11200 | (1,4,3,2,1) |
And the named places
| osm | class | type | geometry |
| W93 | highway | residential | :w2N |
| W93 | highway | residential | 10,11 |
When importing
Then placex contains
| object | postcode |
| W93 | 112 DE 34 |
| object | postcode |
| W93 | 11200 |
Scenario: Postcodes from the lowest admin area with postcode are inherited by ways
Given the scene admin-areas
Given the grid with origin FR
| 1 | | | | 4 | | 6 | | 8 |
| | 10 | | 11 | | | | | |
| 2 | | | | 3 | | 5 | | 7 |
And the named places
| osm | class | type | admin | addr+postcode | geometry |
| R1 | boundary | administrative | 6 | 112 | :b0 |
| R34 | boundary | administrative | 8 | 112 DE | :b1:E |
| R1 | boundary | administrative | 6 | 10000 | (1,8,7,2,1) |
| R34 | boundary | administrative | 8 | 11000 | (1,6,5,2,1) |
And the named places
| osm | class | type | admin | geometry |
| R4 | boundary | administrative | 10 | :b2:N |
| osm | class | type | admin | geometry |
| R4 | boundary | administrative | 10 | (1,4,3,2,1) |
And the named places
| osm | class | type | geometry |
| W93 | highway | residential | :w2N |
| W93 | highway | residential | 10,11 |
When importing
Then placex contains
| object | postcode | parent_place_id |
| W93 | 112 DE | R4 |
| W93 | 11000 | R4 |
Scenario: Postcodes from the lowest admin area are inherited by buildings
Given the scene admin-areas
Given the grid with origin FR
| 1 | | | | 4 | | 6 | | 8 |
| | 10 | | 11 | | | | | |
| | 13 | | 12 | | | | | |
| 2 | | | | 3 | | 5 | | 7 |
And the named places
| osm | class | type | admin | addr+postcode | geometry |
| R1 | boundary | administrative | 6 | 112 | :b0 |
| R34 | boundary | administrative | 8 | 112 DE | :b1:E |
| R4 | boundary | administrative | 10 | 112 DE 34 | :b2:N |
| R1 | boundary | administrative | 6 | 10000 | (1,8,7,2,1) |
| R34 | boundary | administrative | 8 | 11000 | (1,6,5,2,1) |
| R4 | boundary | administrative | 10 | 11200 | (1,4,3,2,1) |
And the named places
| osm | class | type | geometry |
| W22 | building | yes | :building:w2N |
| W22 | building | yes | (10,11,12,13,10) |
When importing
Then placex contains
| object | postcode |
| W22 | 112 DE 34 |
| object | postcode |
| W22 | 11200 |
Scenario: Roads get postcodes from nearby named buildings without other info
Given the scene admin-areas
Given the grid with origin US
| 10 | | | | 11 |
| | 1 | 2 | | |
| | 4 | 3 | | |
And the named places
| osm | class | type | geometry |
| W93 | highway | residential | :w2N |
| W93 | highway | residential | 10,11 |
And the named places
| osm | class | type | addr+postcode | geometry |
| W22 | building | yes | 445023 | :building:w2N |
| osm | class | type | addr+postcode | geometry |
| W22 | building | yes | 45023 | (1,2,3,4,1) |
When importing
Then placex contains
| object | postcode |
| W93 | 445023 |
| W93 | 45023 |
Scenario: Roads get postcodes from nearby unnamed buildings without other info
Given the scene admin-areas
Given the grid with origin US
| 10 | | | | 11 |
| | 1 | 2 | | |
| | 4 | 3 | | |
And the named places
| osm | class | type | geometry |
| W93 | highway | residential | :w2N |
And the named places
| osm | class | type | addr+postcode | geometry |
| W22 | place | postcode | 445023 | :building:w2N |
| W93 | highway | residential | 10,11 |
And the places
| osm | class | type | addr+postcode | geometry |
| W22 | place | postcode | 45023 | (1,2,3,4,1) |
When importing
Then placex contains
| object | postcode |
| W93 | 445023 |
| W93 | 45023 |
Scenario: Postcodes from admin boundaries are preferred over estimated postcodes
Given the scene admin-areas
Given the grid with origin FR
| 1 | | | | 4 | | 6 | | 8 |
| | 10 | | 11 | | | | | |
| | | 22 | | | | | | |
| 2 | | | | 3 | | 5 | | 7 |
And the named places
| osm | class | type | admin | addr+postcode | geometry |
| R1 | boundary | administrative | 6 | 112 | :b0 |
| R34 | boundary | administrative | 8 | 112 DE | :b1:E |
| R4 | boundary | administrative | 10 | 112 DE 34 | :b2:N |
| R1 | boundary | administrative | 6 | 10000 | (1,8,7,2,1) |
| R34 | boundary | administrative | 8 | 11000 | (1,6,5,2,1) |
| R4 | boundary | administrative | 10 | 11200 | (1,4,3,2,1) |
And the named places
| osm | class | type | geometry |
| W93 | highway | residential | :w2N |
| W93 | highway | residential | 10,1 |
And the named places
| osm | class | type | addr+postcode | geometry |
| W22 | building | yes | 445023 | :building:w2N |
| osm | class | type | addr+postcode |
| N22 | building | yes | 45023 |
When importing
Then placex contains
| object | postcode |
| W93 | 112 DE 34 |
| object | postcode |
| W93 | 11200 |
Scenario: Postcodes are added to the postcode and word table
Given the places

View File

@ -26,24 +26,28 @@ Feature: Creation of search terms
| N1 | #Halle Saale, #Halle |
Scenario: Unnamed POIs have no search entry
Given the scene roads-with-pois
Given the grid
| | 1 | | |
| 10 | | | 11 |
And the places
| osm | class | type | geometry |
| N1 | place | house | :p-N1 |
| osm | class | type |
| N1 | place | house |
And the named places
| osm | class | type | geometry |
| W1 | highway | residential | :w-north |
| W1 | highway | residential | 10,11 |
When importing
Then search_name has no entry for N1
Scenario: Unnamed POI has a search entry when it has unknown addr: tags
Given the scene roads-with-pois
Given the grid
| | 1 | | |
| 10 | | | 11 |
And the places
| osm | class | type | housenr | addr+city | geometry |
| N1 | place | house | 23 | Walltown | :p-N1 |
| osm | class | type | housenr | addr+city |
| N1 | place | house | 23 | Walltown |
And the places
| osm | class | type | name+name | geometry |
| W1 | highway | residential | Rose Street | :w-north |
| W1 | highway | residential | Rose Street | 10,11 |
When importing
Then search_name contains
| object | nameaddress_vector |
@ -62,13 +66,15 @@ Feature: Creation of search terms
| N1 | 23, Rose Street |
Scenario: Searching for unknown addr: tags also works for multiple words
Given the scene roads-with-pois
Given the grid
| | 1 | | |
| 10 | | | 11 |
And the places
| osm | class | type | housenr | addr+city | geometry |
| N1 | place | house | 23 | Little Big Town | :p-N1 |
| osm | class | type | housenr | addr+city |
| N1 | place | house | 23 | Little Big Town |
And the places
| osm | class | type | name+name | geometry |
| W1 | highway | residential | Rose Street | :w-north |
| W1 | highway | residential | Rose Street | 10,11 |
When importing
Then search_name contains
| object | nameaddress_vector |
@ -87,13 +93,15 @@ Feature: Creation of search terms
| N1 | 23, Rose Street |
Scenario: Unnamed POI has no search entry when it has known addr: tags
Given the scene roads-with-pois
Given the grid
| | 1 | | |
| 10 | | | 11 |
And the places
| osm | class | type | housenr | addr+city | geometry |
| N1 | place | house | 23 | Walltown | :p-N1 |
| osm | class | type | housenr | addr+city |
| N1 | place | house | 23 | Walltown |
And the places
| osm | class | type | name+name | addr+city | geometry |
| W1 | highway | residential | Rose Street | Walltown | :w-north |
| W1 | highway | residential | Rose Street | Walltown | 10,11 |
When importing
Then search_name has no entry for N1
When sending search query "23 Rose Street, Walltown"
@ -102,29 +110,34 @@ Feature: Creation of search terms
| N1 | 23, Rose Street |
Scenario: Unnamed POI must have a house number to get a search entry
Given the scene roads-with-pois
Given the grid
| | 1 | | |
| 10 | | | 11 |
And the places
| osm | class | type | addr+city | geometry |
| N1 | place | house | Walltown | :p-N1 |
| osm | class | type | addr+city |
| N1 | place | house | Walltown |
And the places
| osm | class | type | name+name | geometry |
| W1 | highway | residential | Rose Street | :w-north |
| W1 | highway | residential | Rose Street | 10,11 |
When importing
Then search_name has no entry for N1
Scenario: Unnamed POIs inherit parent name when unknown addr:place is present
Given the scene roads-with-pois
Given the grid
| 100 | | | | | 101 |
| | | 1 | | | |
| 103 | 10 | | | 11 | 102 |
And the places
| osm | class | type | housenr | addr+place | geometry |
| N1 | place | house | 23 | Walltown | :p-N1 |
| osm | class | type | housenr | addr+place |
| N1 | place | house | 23 | Walltown |
And the places
| osm | class | type | name+name | geometry |
| W1 | highway | residential | Rose Street | :w-north |
| N2 | place | city | Strange Town | :p-N1 |
| W1 | highway | residential | Rose Street | 10,11 |
| R1 | place | city | Strange Town | (100,101,102,103,100) |
When importing
Then placex contains
| object | parent_place_id |
| N1 | N2 |
| N1 | R1 |
When sending search query "23 Rose Street"
Then exactly 1 results are returned
And results contain
@ -144,14 +157,17 @@ Feature: Creation of search terms
| N1 | 23, Walltown, Strange Town |
Scenario: Named POIs can be searched by housenumber when unknown addr:place is present
Given the scene roads-with-pois
Given the grid
| 100 | | | | | 101 |
| | | 1 | | | |
| 103 | 10 | | | 11 | 102 |
And the places
| osm | class | type | name | housenr | addr+place | geometry |
| N1 | place | house | Blue house | 23 | Walltown | :p-N1 |
| osm | class | type | name | housenr | addr+place |
| N1 | place | house | Blue house | 23 | Walltown |
And the places
| osm | class | type | name+name | geometry |
| W1 | highway | residential | Rose Street | :w-north |
| N2 | place | city | Strange Town | :p-N1 |
| W1 | highway | residential | Rose Street | 10,11 |
| R1 | place | city | Strange Town | (100,101,102,103,100) |
When importing
When sending search query "23 Walltown, Strange Town"
Then results contain
@ -175,14 +191,17 @@ Feature: Creation of search terms
| N1 | Blue house, 23, Walltown, Strange Town |
Scenario: Named POIs can be found when unknown multi-word addr:place is present
Given the scene roads-with-pois
Given the grid
| 100 | | | | | 101 |
| | | 1 | | | |
| 103 | 10 | | | 11 | 102 |
And the places
| osm | class | type | name | housenr | addr+place | geometry |
| N1 | place | house | Blue house | 23 | Moon sun | :p-N1 |
| osm | class | type | name | housenr | addr+place |
| N1 | place | house | Blue house | 23 | Moon sun |
And the places
| osm | class | type | name+name | geometry |
| W1 | highway | residential | Rose Street | :w-north |
| N2 | place | city | Strange Town | :p-N1 |
| W1 | highway | residential | Rose Street | 10,11 |
| R1 | place | city | Strange Town | (100,101,102,103,100) |
When importing
When sending search query "23 Moon Sun, Strange Town"
Then results contain
@ -194,14 +213,17 @@ Feature: Creation of search terms
| N1 | Blue house, 23, Moon sun, Strange Town |
Scenario: Unnamed POIs doesn't inherit parent name when addr:place is present only in parent address
Given the scene roads-with-pois
Given the grid
| 100 | | | | | 101 |
| | | 1 | | | |
| 103 | 10 | | | 11 | 102 |
And the places
| osm | class | type | housenr | addr+place | geometry |
| N1 | place | house | 23 | Walltown | :p-N1 |
| osm | class | type | housenr | addr+place |
| N1 | place | house | 23 | Walltown |
And the places
| osm | class | type | name+name | addr+city | geometry |
| W1 | highway | residential | Rose Street | Walltown | :w-north |
| N2 | place | suburb | Strange Town | Walltown | :p-N1 |
| W1 | highway | residential | Rose Street | Walltown | 10,11 |
| R1 | place | suburb | Strange Town | Walltown | (100,101,102,103,100) |
When importing
When sending search query "23 Rose Street, Walltown"
Then exactly 1 result is returned
@ -215,13 +237,15 @@ Feature: Creation of search terms
| N1 | 23, Walltown, Strange Town |
Scenario: Unnamed POIs does inherit parent name when unknown addr:place and addr:street is present
Given the scene roads-with-pois
Given the grid
| | 1 | | |
| 10 | | | 11 |
And the places
| osm | class | type | housenr | addr+place | addr+street | geometry |
| N1 | place | house | 23 | Walltown | Lily Street | :p-N1 |
| osm | class | type | housenr | addr+place | addr+street |
| N1 | place | house | 23 | Walltown | Lily Street |
And the places
| osm | class | type | name+name | geometry |
| W1 | highway | residential | Rose Street | :w-north |
| W1 | highway | residential | Rose Street | 10,11 |
When importing
Then search_name has no entry for N1
When sending search query "23 Rose Street"
@ -232,13 +256,15 @@ Feature: Creation of search terms
Then exactly 0 results are returned
Scenario: An unknown addr:street is ignored
Given the scene roads-with-pois
Given the grid
| | 1 | | |
| 10 | | | 11 |
And the places
| osm | class | type | housenr | addr+street | geometry |
| N1 | place | house | 23 | Lily Street | :p-N1 |
| osm | class | type | housenr | addr+street |
| N1 | place | house | 23 | Lily Street |
And the places
| osm | class | type | name+name | geometry |
| W1 | highway | residential | Rose Street | :w-north |
| W1 | highway | residential | Rose Street | 10,11 |
When importing
Then search_name has no entry for N1
When sending search query "23 Rose Street"
@ -249,13 +275,15 @@ Feature: Creation of search terms
Then exactly 0 results are returned
Scenario: Named POIs get unknown address tags added in the search_name table
Given the scene roads-with-pois
Given the grid
| | 1 | | |
| 10 | | | 11 |
And the places
| osm | class | type | name+name | housenr | addr+city | geometry |
| N1 | place | house | Green Moss | 26 | Walltown | :p-N1 |
| osm | class | type | name+name | housenr | addr+city |
| N1 | place | house | Green Moss | 26 | Walltown |
And the places
| osm | class | type | name+name | geometry |
| W1 | highway | residential | Rose Street | :w-north |
| W1 | highway | residential | Rose Street | 10,11 |
When importing
Then search_name contains
| object | name_vector | nameaddress_vector |
@ -282,14 +310,17 @@ Feature: Creation of search terms
| N1 | Green Moss, 26, Rose Street |
Scenario: Named POI doesn't inherit parent name when addr:place is present only in parent address
Given the scene roads-with-pois
Given the grid
| 100 | | | | | 101 |
| | | 1 | | | |
| 103 | 10 | | | 11 | 102 |
And the places
| osm | class | type | name+name | addr+place | geometry |
| N1 | place | house | Green Moss | Walltown | :p-N1 |
| osm | class | type | name+name | addr+place |
| N1 | place | house | Green Moss | Walltown |
And the places
| osm | class | type | name+name | geometry |
| W1 | highway | residential | Rose Street | :w-north |
| N2 | place | suburb | Strange Town | :p-N1 |
| W1 | highway | residential | Rose Street | 10,11 |
| R1 | place | suburb | Strange Town | (100,101,102,103,100) |
When importing
When sending search query "Green Moss, Rose Street, Walltown"
Then exactly 0 result is returned
@ -299,60 +330,71 @@ Feature: Creation of search terms
| N1 | Green Moss, Walltown, Strange Town |
Scenario: Named POIs inherit address from parent
Given the scene roads-with-pois
Given the grid
| | 1 | | |
| 10 | | | 11 |
And the places
| osm | class | type | name | geometry |
| N1 | place | house | foo | :p-N1 |
| W1 | highway | residential | the road | :w-north |
| N1 | place | house | foo | 1 |
| W1 | highway | residential | the road | 10,11 |
When importing
Then search_name contains
| object | name_vector | nameaddress_vector |
| N1 | foo | #the road |
Scenario: Some addr: tags are added to address
Given the scene roads-with-pois
Given the grid
| | 2 | 3 | |
| 10 | | | 11 |
And the places
| osm | class | type | name | geometry |
| N2 | place | city | bonn | 81 81 |
| N3 | place | suburb | smalltown| 80 81 |
| osm | class | type | name |
| N2 | place | city | bonn |
| N3 | place | suburb | smalltown|
And the named places
| osm | class | type | addr+city | addr+municipality | addr+suburb | geometry |
| W1 | highway | service | bonn | New York | Smalltown | :w-north |
| W1 | highway | service | bonn | New York | Smalltown | 10,11 |
When importing
Then search_name contains
| object | nameaddress_vector |
| W1 | bonn, new, york, smalltown |
Scenario: A known addr:* tag is added even if the name is unknown
Given the scene roads-with-pois
Given the grid
| 10 | | | | 11 |
And the places
| osm | class | type | name | addr+city | geometry |
| W1 | highway | residential | Road | Nandu | :w-north |
| W1 | highway | residential | Road | Nandu | 10,11 |
When importing
Then search_name contains
| object | nameaddress_vector |
| W1 | nandu |
Scenario: addr:postcode is not added to the address terms
Given the scene roads-with-pois
Given the grid with origin DE
| | 1 | | |
| 10 | | | 11 |
And the places
| osm | class | type | name+ref | geometry |
| N1 | place | state | 12345 | 80 80 |
| osm | class | type | name+ref |
| N1 | place | state | 12345 |
And the named places
| osm | class | type | addr+postcode | geometry |
| W1 | highway | residential | 12345 | :w-north |
| W1 | highway | residential | 12345 | 10,11 |
When importing
Then search_name contains not
| object | nameaddress_vector |
| W1 | 12345 |
Scenario: a linked place does not show up in search name
Given the 0.01 grid
| 10 | | 11 |
| | 2 | |
| 13 | | 12 |
Given the named places
| osm | class | type | admin | geometry |
| R13 | boundary | administrative | 9 | poly-area:0.01 |
| R13 | boundary | administrative | 9 | (10,11,12,13,10) |
And the named places
| osm | class | type | geometry |
| N2 | place | city | 0.1 0.1 |
| osm | class | type |
| N2 | place | city |
And the relations
| id | members | tags+type |
| 13 | N2:label | boundary |
@ -363,12 +405,13 @@ Feature: Creation of search terms
And search_name has no entry for N2
Scenario: a linked waterway does not show up in search name
Given the scene split-road
Given the grid
| 1 | | 2 | | 3 |
And the places
| osm | class | type | name | geometry |
| W1 | waterway | river | Rhein | :w-2 |
| W2 | waterway | river | Rhein | :w-3 |
| R13 | waterway | river | Rhein | :w-1 + :w-2 + :w-3 |
| W1 | waterway | river | Rhein | 1,2 |
| W2 | waterway | river | Rhein | 2,3 |
| R13 | waterway | river | Rhein | 1,2,3 |
And the relations
| id | members | tags+type |
| 13 | W1,W2:main_stream | waterway |

View File

@ -69,7 +69,7 @@ def define_node_grid(context, grid_step, origin):
coords = origin.split(',')
if len(coords) != 2:
raise RuntimeError('Grid origin expects orgin with x,y coordinates.')
origin(float(coords[0]), float(coords[1]))
origin = (float(coords[0]), float(coords[1]))
elif origin in ALIASES:
origin = ALIASES[origin]
else:

View File

@ -157,7 +157,11 @@ class DBRow:
ST_SetSRID('{geomtxt}'::geometry, 4326))""".format(**self.db_row))
return cur.fetchone()[0]
x, y = expected.split(' ')
if ' ' in expected:
x, y = expected.split(' ')
else:
x, y = self.context.osm.grid_node(int(expected))
return Almost(float(x)) == self.db_row['cx'] and Almost(float(y)) == self.db_row['cy']
def _has_geometry(self, expected):