add BDD tests for DB

This commit is contained in:
Sarah Hoffmann
2025-04-09 14:52:34 +02:00
parent 5f44aa2873
commit b34991d85f
33 changed files with 6095 additions and 46 deletions

View File

@@ -0,0 +1,531 @@
Feature: Address computation
Tests for filling of place_addressline
Scenario: place nodes are added to the address when they are close enough
Given the 0.002 grid
| 2 | | | | | | 1 | | 3 |
And the places
| osm | class | type | name | geometry |
| N1 | place | square | Square | 1 |
| N2 | place | hamlet | West Farm | 2 |
| N3 | place | hamlet | East Farm | 3 |
When importing
Then place_addressline contains exactly
| object | address | fromarea |
| N1 | N3 | False |
When geocoding "Square"
Then the result set contains
| object | display_name |
| N1 | Square, East Farm |
Scenario: given two place nodes, the closer one wins for the address
Given the grid
| 2 | | | 1 | | 3 |
And the named places
| osm | class | type | geometry |
| N1 | place | square | 1 |
| N2 | place | hamlet | 2 |
| N3 | place | hamlet | 3 |
When importing
Then place_addressline contains
| object | address | fromarea | isaddress |
| N1 | N3 | False | True |
| N1 | N2 | False | False |
Scenario: boundaries around the place are added to the address
Given the grid
| 1 | | 4 | | 7 | 10 |
| 2 | | 5 | | 8 | 11 |
| | | | | | |
| | | | | | |
| | | 6 | | 9 | |
| | 99 | | | | |
| 3 | | | | | 12 |
And the named places
| osm | class | type | admin | geometry |
| R1 | boundary | administrative | 3 | (1,2,3,12,11,10,7,8,9,6,5,4,1) |
| R2 | boundary | administrative | 4 | (2,3,12,11,8,9,6,5,2) |
| N1 | place | square | 15 | 99 |
When importing
Then place_addressline contains
| object | address | isaddress |
| N1 | R1 | True |
| N1 | R2 | True |
Scenario: with boundaries of same rank the one with the closer centroid is preferred
Given the grid
| 1 | | | 3 | | 5 |
| | 9 | | | | |
| 2 | | | 4 | | 6 |
And the named places
| osm | class | type | admin | geometry |
| R1 | boundary | administrative | 8 | (1,2,4,3,1) |
| R2 | boundary | administrative | 8 | (1,2,6,5,1) |
| N1 | place | square | 15 | 9 |
When importing
Then place_addressline contains
| object | address | isaddress |
| N1 | R1 | True |
| N1 | R2 | False |
Scenario: boundary areas are preferred over place nodes in the address
Given the grid
| 1 | | | | 10 | | 3 |
| | 5 | | | | | |
| | 6 | | | | | |
| 2 | | | | 11 | | 4 |
And the named places
| osm | class | type | admin | geometry |
| N1 | place | square | 15 | 5 |
| N2 | place | city | 15 | 6 |
| R1 | place | city | 8 | (1,2,4,3,1) |
| R2 | boundary | administrative | 9 | (1,10,11,2,1) |
When importing
Then place_addressline contains
| object | address | isaddress | cached_rank_address |
| N1 | R1 | True | 16 |
| N1 | R2 | True | 18 |
| N1 | N2 | False | 18 |
Scenario: place nodes outside a smaller ranked area are ignored
Given the grid
| 1 | | 2 | |
| | 7 | | 9 |
| 4 | | 3 | |
And the named places
| osm | class | type | admin | geometry |
| N1 | place | square | 15 | 7 |
| N2 | place | city | 15 | 9 |
| R1 | place | city | 8 | (1,2,3,4,1) |
When importing
Then place_addressline contains exactly
| object | address | isaddress | cached_rank_address |
| N1 | R1 | True | 16 |
Scenario: place nodes close enough to smaller ranked place nodes are included
Given the 0.002 grid
| 2 | | 3 | 1 |
And the named places
| osm | class | type | geometry |
| N1 | place | square | 1 |
| N2 | place | hamlet | 2 |
| N3 | place | quarter | 3 |
When importing
Then place_addressline contains
| object | address | fromarea | isaddress |
| N1 | N2 | False | True |
| N1 | N3 | False | True |
Scenario: place nodes too far away from a smaller ranked place nodes are marked non-address
Given the 0.002 grid
| 2 | | | 1 | | 3 |
And the named places
| osm | class | type | geometry |
| N1 | place | square | 1 |
| N2 | place | hamlet | 2 |
| N3 | place | quarter | 3 |
When importing
Then place_addressline contains
| object | address | fromarea | isaddress |
| N1 | N2 | False | True |
| N1 | N3 | False | False |
# github #121
Scenario: Roads crossing boundaries should contain both states
Given the grid
| 1 | | | 2 | | 3 |
| | 7 | | | 8 | |
| 4 | | | 5 | | 6 |
And the named places
| osm | class | type | geometry |
| W1 | highway | road | 7, 8 |
And the named places
| osm | class | type | admin | geometry |
| W10 | boundary | administrative | 5 | (1, 2, 5, 4, 1) |
| W11 | boundary | administrative | 5 | (2, 3, 6, 5, 2) |
When importing
Then place_addressline contains
| object | address | cached_rank_address |
| W1 | W10 | 10 |
| W1 | W11 | 10 |
Scenario: Roads following a boundary should contain both states
Given the grid
| 1 | | | 2 | | 3 |
| | | 8 | 7 | | |
| 4 | | | 5 | | 6 |
And the named places
| osm | class | type | geometry |
| W1 | highway | road | 2, 7, 8 |
And the named places
| osm | class | type | admin | geometry |
| W10 | boundary | administrative | 5 | (1, 2, 5, 4, 1) |
| W11 | boundary | administrative | 5 | (2, 3, 6, 5, 2) |
When importing
Then place_addressline contains
| object | address | cached_rank_address |
| W1 | W10 | 10 |
| W1 | W11 | 10 |
Scenario: Roads should not contain boundaries they touch in a end point
Given the grid
| 1 | | | 2 | | 3 |
| | 7 | | 8 | | |
| 4 | | | 5 | | 6 |
And the named places
| osm | class | type | geometry |
| W1 | highway | road | 7, 8 |
And the named places
| osm | class | type | admin | geometry |
| W10 | boundary | administrative | 5 | (1, 2, 8, 5, 4, 1) |
| W11 | boundary | administrative | 5 | (2, 3, 6, 5, 8, 2) |
When importing
Then place_addressline contains exactly
| object | address | cached_rank_address |
| W1 | W10 | 10 |
Scenario: Roads should not contain boundaries they touch in a middle point
Given the grid
| 1 | | | 2 | | 3 |
| | 7 | | 8 | | |
| 4 | | 9 | 5 | | 6 |
And the named places
| osm | class | type | geometry |
| W1 | highway | road | 7, 8, 9 |
And the named places
| osm | class | type | admin | geometry |
| W10 | boundary | administrative | 5 | (1, 2, 8, 5, 4, 1) |
| W11 | boundary | administrative | 5 | (2, 3, 6, 5, 8, 2) |
When importing
Then place_addressline contains exactly
| object | address | cached_rank_address |
| W1 | W10 | 10 |
Scenario: Locality points should contain all boundaries they touch
Given the 0.001 grid
| 1 | | | 2 | | 3 |
| | | | 8 | | |
| 4 | | | 5 | | 6 |
And the named places
| osm | class | type | geometry |
| N1 | place | locality | 8 |
And the named places
| osm | class | type | admin | geometry |
| W10 | boundary | administrative | 5 | (1, 2, 8, 5, 4, 1) |
| W11 | boundary | administrative | 5 | (2, 3, 6, 5, 8, 2) |
When importing
Then place_addressline contains
| object | address | cached_rank_address |
| N1 | W10 | 10 |
| N1 | W11 | 10 |
Scenario: Areas should not contain boundaries they touch
Given the grid
| 1 | | | 2 | | 3 |
| | | | | | |
| 4 | | | 5 | | 6 |
And the named places
| osm | class | type | geometry |
| W1 | landuse | industrial | (1, 2, 5, 4, 1) |
And the named places
| osm | class | type | admin | geometry |
| W10 | boundary | administrative | 5 | (2, 3, 6, 5, 2) |
When importing
Then place_addressline contains exactly
| object | address |
Scenario: buildings with only addr:postcodes do not appear in the address of a way
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 | 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 | 20,21 |
And the places
| osm | class | type | addr+postcode | geometry |
| W22 | place | postcode | 11234 | (10,11,12,13,10) |
When importing
Then place_addressline contains exactly
| object | address |
| R4 | R1 |
| R4 | R34 |
| R34 | R1 |
| W93 | R1 |
| W93 | R34 |
| W93 | R4 |
Scenario: postcode boundaries do appear in the address of a way
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 | 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 | 11200 | (1,8,9,4,1) |
And the named places
| osm | class | type | geometry |
| W93 | highway | residential | 20,21 |
And the places
| osm | class | type | addr+postcode | geometry |
| W22 | place | postcode | 11234 | (10,11,12,13,10) |
When importing
Then place_addressline contains
| object | address |
| W93 | R4 |
Scenario: squares do not appear in the address of a street
Given the grid
| | 1 | | 2 | |
| 8 | | | | 9 |
| | 4 | | 3 | |
And the named places
| osm | class | type | geometry |
| W1 | highway | residential | 8, 9 |
| W2 | place | square | (1, 2, 3 ,4, 1) |
When importing
Then place_addressline contains exactly
| object | address |
Scenario: addr:* tags are honored even when a street is far away from the place
Given the grid
| 1 | | 2 | | | 5 |
| | | | 8 | 9 | |
| 4 | | 3 | | | 6 |
And the places
| osm | class | type | admin | name | geometry |
| R1 | boundary | administrative | 8 | Left | (1,2,3,4,1) |
| R2 | boundary | administrative | 8 | Right | (2,3,6,5,2) |
And the places
| osm | class | type | addr+city | geometry |
| W1 | highway | primary | Left | 8,9 |
| W2 | highway | primary | Right | 8,9 |
When importing
Then place_addressline contains exactly
| object | address | isaddress |
| W1 | R1 | True |
| W1 | R2 | False |
| W2 | R2 | True |
Scenario: addr:* tags are honored even when a POI is far away from the place
Given the grid
| 1 | | 2 | | | 5 |
| | | | 8 | 9 | |
| 4 | | 3 | | | 6 |
And the places
| osm | class | type | admin | name | geometry |
| R1 | boundary | administrative | 8 | Left | (1,2,3,4,1) |
| R2 | boundary | administrative | 8 | Right | (2,3,6,5,2) |
And the places
| osm | class | type | name | addr+city | geometry |
| W1 | highway | primary | Wonderway | Right | 8,9 |
| N1 | amenity | cafe | Bolder | Left | 9 |
When importing
Then place_addressline contains exactly
| object | address | isaddress |
| W1 | R2 | True |
| N1 | R1 | True |
When geocoding "Bolder"
Then the result set contains
| object | display_name |
| N1 | Bolder, Wonderway, Left |
Scenario: addr:* tags do not produce addresslines when the parent has the address part
Given the grid
| 1 | | | 5 |
| | 8 | 9 | |
| 4 | | | 6 |
And the places
| osm | class | type | admin | name | geometry |
| R1 | boundary | administrative | 8 | Outer | (1,5,6,4,1) |
And the places
| osm | class | type | name | addr+city | geometry |
| W1 | highway | primary | Wonderway | Outer | 8,9 |
| N1 | amenity | cafe | Bolder | Outer | 9 |
When importing
Then place_addressline contains exactly
| object | address | isaddress |
| W1 | R1 | True |
When geocoding "Bolder"
Then the result set contains
| object | display_name |
| N1 | Bolder, Wonderway, Outer |
Scenario: addr:* tags on outside do not produce addresslines when the parent has the address part
Given the grid
| 1 | | 2 | | | 5 |
| | | | 8 | 9 | |
| 4 | | 3 | | | 6 |
And the places
| osm | class | type | admin | name | geometry |
| R1 | boundary | administrative | 8 | Left | (1,2,3,4,1) |
| R2 | boundary | administrative | 8 | Right | (2,3,6,5,2) |
And the places
| osm | class | type | name | addr+city | geometry |
| W1 | highway | primary | Wonderway | Left | 8,9 |
| N1 | amenity | cafe | Bolder | Left | 9 |
When importing
Then place_addressline contains exactly
| object | address | isaddress |
| W1 | R1 | True |
| W1 | R2 | False |
When geocoding "Bolder"
Then the result set contains
| object | display_name |
| N1 | Bolder, Wonderway, Left |
Scenario: POIs can correct address parts on the fly
Given the grid
| 1 | | | | 2 | | 5 |
| | | | 9 | | 8 | |
| 4 | | | | 3 | | 6 |
And the places
| osm | class | type | admin | name | geometry |
| R1 | boundary | administrative | 8 | Left | (1,2,3,4,1) |
| R2 | boundary | administrative | 8 | Right | (2,3,6,5,2) |
And the places
| osm | class | type | name | geometry |
| W1 | highway | primary | Wonderway | 2,3 |
| N1 | amenity | cafe | Bolder | 9 |
| N2 | amenity | cafe | Leftside | 8 |
When importing
Then place_addressline contains exactly
| object | address | isaddress |
| W1 | R1 | False |
| W1 | R2 | True |
When geocoding "Bolder"
Then the result set contains
| object | display_name |
| N1 | Bolder, Wonderway, Left |
When geocoding "Leftside"
Then the result set contains
| object | display_name |
| N2 | Leftside, Wonderway, Right |
Scenario: POIs can correct address parts on the fly (with partial unmatching address)
Given the grid
| 1 | | | | 2 | | 5 |
| | | | 9 | | 8 | |
| | 10| 11| | | 12| |
| 4 | | | | 3 | | 6 |
And the places
| osm | class | type | admin | name | geometry |
| R1 | boundary | administrative | 8 | Left | (1,2,3,4,1) |
| R2 | boundary | administrative | 8 | Right | (2,3,6,5,2) |
And the places
| osm | class | type | name | geometry |
| W1 | highway | primary | Wonderway | 10,11,12 |
And the places
| osm | class | type | name | addr+suburb | geometry |
| N1 | amenity | cafe | Bolder | Boring | 9 |
| N2 | amenity | cafe | Leftside | Boring | 8 |
When importing
Then place_addressline contains exactly
| object | address | isaddress |
| W1 | R1 | True |
| W1 | R2 | False |
When geocoding "Bolder"
Then the result set contains
| object | display_name |
| N1 | Bolder, Wonderway, Left |
When geocoding "Leftside"
Then the result set contains
| object | display_name |
| N2 | Leftside, Wonderway, Right |
Scenario: POIs can correct address parts on the fly (with partial matching address)
Given the grid
| 1 | | | | 2 | | 5 |
| | | | 9 | | 8 | |
| | 10| 11| | | 12| |
| 4 | | | | 3 | | 6 |
And the places
| osm | class | type | admin | name | geometry |
| R1 | boundary | administrative | 8 | Left | (1,2,3,4,1) |
| R2 | boundary | administrative | 8 | Right | (2,3,6,5,2) |
And the places
| osm | class | type | name | geometry |
| W1 | highway | primary | Wonderway | 10,11,12 |
And the places
| osm | class | type | name | addr+state | geometry |
| N1 | amenity | cafe | Bolder | Left | 9 |
| N2 | amenity | cafe | Leftside | Left | 8 |
When importing
Then place_addressline contains exactly
| object | address | isaddress |
| W1 | R1 | True |
| W1 | R2 | False |
When geocoding "Bolder"
Then the result set contains
| object | display_name |
| N1 | Bolder, Wonderway, Left |
When geocoding "Leftside"
Then the result set contains
| object | display_name |
| N2 | Leftside, Wonderway, Left |
Scenario: addr:* tags always match the closer area
Given the grid
| 1 | | | | 2 | | 5 |
| | | | | | | |
| 4 | | | | 3 | | 6 |
| | 10| 11| | | | |
And the places
| osm | class | type | admin | name | geometry |
| R1 | boundary | administrative | 8 | Left | (1,2,3,4,1) |
| R2 | boundary | administrative | 8 | Left | (2,3,6,5,2) |
And the places
| osm | class | type | name | addr+city | geometry |
| W1 | highway | primary | Wonderway | Left | 10,11 |
When importing
Then place_addressline contains exactly
| object | address |
| W1 | R1 |
Scenario: Full name is prefered for unlisted addr:place tags
Given the grid
| | 1 | 2 | |
| 8 | | | 9 |
And the places
| osm | class | type | name | geometry |
| W10 | place | city | Away | (8,1,2,9,8) |
And the places
| osm | class | type | name | addr+city | geometry |
| W1 | highway | residential | Royal Terrace | Gardens | 8,9 |
And the places
| osm | class | type | housenr | addr+place | geometry | extra+foo |
| N1 | place | house | 1 | Royal Terrace Gardens | 1 | bar |
And the places
| osm | class | type | housenr | addr+street | geometry |
| N2 | place | house | 2 | Royal Terrace | 2 |
When importing
When geocoding "1, Royal Terrace Gardens"
Then result 0 contains
| object |
| N1 |

View File

@@ -0,0 +1,91 @@
Feature: Country handling
Tests for import and use of country information
Scenario: Country names from OSM country relations are added
Given the places
| osm | class | type | admin | name+name:xy | country | geometry |
| R1 | boundary | administrative | 2 | Loudou | de | (9 52, 9 53, 10 52, 9 52) |
Given the places
| osm | class | type | name | geometry |
| N1 | place | town | Wenig | country:de |
When importing
When geocoding "Wenig, Loudou"
Then the result set contains
| object | display_name |
| N1 | Wenig, Deutschland |
When geocoding "Wenig"
| accept-language |
| xy,en |
Then the result set contains
| object | display_name |
| N1 | Wenig, Loudou |
Scenario: OSM country relations outside expected boundaries are ignored for naming
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 | (1,2,3,4,1) |
Given the places
| osm | class | type | name | geometry |
| N1 | place | town | Wenig | country:de |
When importing
When geocoding "Wenig"
| accept-language |
| xy,en |
Then the result set contains
| object | display_name |
| N1 | Wenig, Germany |
Scenario: Pre-defined country names are used
Given the grid with origin CH
| 1 |
Given the places
| osm | class | type | name | geometry |
| N1 | place | town | Ingb | 1 |
When importing
And geocoding "Ingb"
| accept-language |
| en,de |
Then the result set contains
| object | display_name |
| N1 | Ingb, Switzerland |
Scenario: For overlapping countries, pre-defined countries are tie-breakers
Given the grid with origin US
| 1 | | 2 | | 5 |
| | 9 | | 8 | |
| 4 | | 3 | | 6 |
Given the named places
| osm | class | type | admin | country | geometry |
| R1 | boundary | administrative | 2 | de | (1,5,6,4,1) |
| R2 | boundary | administrative | 2 | us | (1,2,3,4,1) |
And the named places
| osm | class | type | geometry |
| N1 | place | town | 9 |
| N2 | place | town | 8 |
When importing
Then placex contains
| object | country_code |
| N1 | us |
| N2 | de |
Scenario: For overlapping countries outside pre-define countries prefer smaller partition
Given the grid with origin US
| 1 | | 2 | | 5 |
| | 9 | | 8 | |
| 4 | | 3 | | 6 |
Given the named places
| osm | class | type | admin | country | geometry |
| R1 | boundary | administrative | 2 | ch | (1,5,6,4,1) |
| R2 | boundary | administrative | 2 | de | (1,2,3,4,1) |
And the named places
| osm | class | type | geometry |
| N1 | place | town | 9 |
| N2 | place | town | 8 |
When importing
Then placex contains
| object | country_code |
| N1 | de |
| N2 | ch |

View File

@@ -0,0 +1,616 @@
Feature: Import of address interpolations
Tests that interpolated addresses are added correctly
Scenario: Simple even interpolation line with two points and no street nearby
Given the grid with origin 1,1
| 1 | | 9 | | 2 |
Given the places
| 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,2 |
And the ways
| id | nodes |
| 1 | 1,2 |
When importing
Then W1 expands to no interpolation
Scenario: Simple even interpolation line with two points
Given the grid with origin 1,1
| 1 | | 9 | | 2 |
| 4 | | | | 5 |
Given the places
| 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,2 |
And the named places
| osm | class | type | geometry |
| W10 | highway | residential | 4,5 |
And the ways
| id | nodes |
| 1 | 1,2 |
When importing
Then W1 expands to interpolation
| start | end | geometry |
| 4 | 4 | 9 |
Scenario: Backwards even two point interpolation line
Given the grid with origin 1,1
| 1 | 8 | 9 | 2 |
| 4 | | | 5 |
Given the places
| 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 | 2,1 |
And the named places
| osm | class | type | geometry |
| W10 | highway | residential | 4,5 |
And the ways
| id | nodes |
| 1 | 2,1 |
When importing
Then W1 expands to interpolation
| start | end | geometry |
| 4 | 6 | 8,9 |
Scenario: Simple odd two point interpolation
Given the grid with origin 1,1
| 1 | 8 | | | 9 | 2 |
| 4 | | | | 5 | |
Given the places
| 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,2 |
And the named places
| osm | class | type | geometry |
| W10 | highway | residential | 4,5 |
And the ways
| id | nodes |
| 1 | 1,2 |
When importing
Then W1 expands to interpolation
| start | end | geometry |
| 3 | 9 | 8,9 |
Scenario: Simple all two point interpolation
Given the grid with origin 1,1
| 1 | 8 | 9 | 2 |
| 4 | | | 5 |
Given the places
| 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,2 |
And the named places
| osm | class | type | geometry |
| W10 | highway | residential | 4,5 |
And the ways
| id | nodes |
| 1 | 1,2 |
When importing
Then W1 expands to interpolation
| start | end | geometry |
| 2 | 3 | 8,9 |
Scenario: Even two point interpolation line with intermediate empty node
Given the grid
| 1 | 8 | | 3 | 9 | 2 |
| 4 | | | | 5 | |
Given the places
| 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,3,2 |
And the named places
| osm | class | type | geometry |
| W10 | highway | residential | 4,5 |
And the ways
| id | nodes |
| 1 | 1,3,2 |
When importing
Then W1 expands to interpolation
| start | end | geometry |
| 4 | 10 | 8,3,9 |
Scenario: Even two point interpolation line with intermediate duplicated empty node
Given the grid
| 4 | | | | 5 |
| 1 | 8 | 3 | 9 | 2 |
Given the places
| 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,3,2 |
And the named places
| osm | class | type | geometry |
| W10 | highway | residential | 4,5 |
And the ways
| id | nodes |
| 1 | 1,3,3,2 |
When importing
Then W1 expands to interpolation
| start | end | geometry |
| 4 | 8 | 8,3,9 |
Scenario: Simple even three point interpolation line
Given the grid
| 4 | | | | | | 5 |
| 1 | 8 | | 9 | 3 | 7 | 2 |
Given the places
| 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,3,2 |
And the named places
| osm | class | type | geometry |
| W10 | highway | residential | 4,5 |
And the ways
| id | nodes |
| 1 | 1,3,2 |
When importing
Then W1 expands to interpolation
| start | end | geometry |
| 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 |
| 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,3,2,4 |
And the named places
| osm | class | type | geometry |
| W10 | highway | residential | 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 | 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 |
| 4 | | | | | | 5 |
Given the places
| 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 | 2,3,1 |
And the named places
| osm | class | type | geometry |
| W10 | highway | residential | 4,5 |
And the ways
| id | nodes |
| 1 | 2,3,1 |
When importing
Then W1 expands to interpolation
| start | end | geometry |
| 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 |
| 4 | | | | | | 5 |
Given the places
| 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,3,2 |
And the named places
| osm | class | type | geometry |
| W10 | highway | residential | 4,5 |
And the ways
| id | nodes |
| 1 | 1,3,2 |
When importing
Then W1 expands to interpolation
| start | end | geometry |
| 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 |
| 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 | 1,2,3,2 |
And the named places
| osm | class | type | geometry |
| W10 | highway | residential | 1,2,3 |
And the ways
| id | nodes |
| 1 | 1,2,3,2 |
When importing
Then W1 expands to interpolation
| start | end | geometry |
| 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 |
| N1 | place | house | 2 |
| N2 | place | house | 6 |
And the places
| osm | class | type | addr+interpolation | geometry |
| W1 | place | houses | even | 1,2,3,2 |
And the named places
| osm | class | type | geometry |
| W10 | highway | residential | 1,2,3 |
And the ways
| id | nodes |
| 1 | 1,2,3,2 |
When importing
Then W1 expands to interpolation
| start | end | geometry |
| 4 | 4 | 9 |
Scenario: addr:street on interpolation way
Given the grid
| | 1 | | 2 | |
| 10 | | | | 11 |
| 20 | | | | 21 |
And the places
| osm | class | type | housenr | geometry |
| 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 | | 1,2 |
| W11 | place | houses | even | Cloud Street | 1,2 |
And the places
| osm | class | type | name | geometry |
| W2 | highway | tertiary | Sun Way | 10,11 |
| W3 | highway | tertiary | Cloud Street | 20,21 |
And the ways
| id | nodes |
| 10 | 1,2 |
| 11 | 3,4 |
When importing
Then placex contains
| object | parent_place_id |
| N1 | W2 |
| N2 | W2 |
| N3 | W3 |
| N4 | W3 |
Then W10 expands to interpolation
| parent_place_id | start | end |
| W2 | 4 | 4 |
Then W11 expands to interpolation
| parent_place_id | start | end |
| W3 | 14 | 14 |
When geocoding "16 Cloud Street"
Then result 0 contains
| object |
| N4 |
When geocoding "14 Cloud Street"
Then result 0 contains
| object |
| W11 |
Scenario: addr:street on housenumber way
Given the grid
| | 1 | | 2 | |
| 10 | | | | 11 |
| 20 | | | | 21 |
And the places
| osm | class | type | housenr | street | geometry |
| 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 | 1,2 |
| W11 | place | houses | even | 1,2 |
And the places
| osm | class | type | name | geometry |
| W2 | highway | tertiary | Sun Way | 10,11 |
| W3 | highway | tertiary | Cloud Street | 20,21 |
And the ways
| id | nodes |
| 10 | 1,2 |
| 11 | 3,4 |
When importing
Then placex contains
| object | parent_place_id |
| N1 | W2 |
| N2 | W2 |
| N3 | W3 |
| N4 | W3 |
Then W10 expands to interpolation
| parent_place_id | start | end |
| W2 | 4 | 4 |
Then W11 expands to interpolation
| parent_place_id | start | end |
| W3 | 14 | 14 |
When geocoding "16 Cloud Street"
Then result 0 contains
| object |
| N4 |
When geocoding "14 Cloud Street"
Then result 0 contains
| object |
| W11 |
Scenario: Geometry of points and way don't match (github #253)
Given the places
| osm | class | type | housenr | geometry |
| N1 | place | house | 10 | 144.9632341 -37.76163 |
| N2 | place | house | 6 | 144.9630541 -37.7628174 |
| N3 | shop | supermarket | 2 | 144.9629794 -37.7630755 |
And the places
| osm | class | type | addr+interpolation | geometry |
| W1 | place | houses | even | 144.9632341 -37.76163,144.9630541 -37.7628172,144.9629794 -37.7630755 |
And the named places
| osm | class | type | geometry |
| W10 | highway | residential | 144.9632341 -37.76163,144.9629794 -37.7630755 |
And the ways
| id | nodes |
| 1 | 1,2,3 |
When importing
Then W1 expands to interpolation
| start | end | geometry |
| 4 | 4 | 144.96301672 -37.76294644 |
| 8 | 8 | 144.96314407 -37.762223692 |
Scenario: Place with missing address information
Given the grid
| 1 | | 2 | | | 3 |
| 4 | | | | | 5 |
And the places
| osm | class | type | housenr |
| N1 | place | house | 23 |
| N2 | amenity | school | |
| N3 | place | house | 29 |
And the places
| osm | class | type | addr+interpolation | geometry |
| W1 | place | houses | odd | 1,2,3 |
And the named places
| osm | class | type | geometry |
| W10 | highway | residential | 4,5 |
And the ways
| id | nodes |
| 1 | 1,2,3 |
When importing
Then W1 expands to interpolation
| start | end | geometry |
| 25 | 27 | 0.0000166 0,0.00002 0,0.0000333 0 |
Scenario: Ways without node entries are ignored
Given the places
| osm | class | type | housenr | geometry |
| W1 | place | houses | even | 1 1, 1 1.001 |
And the named places
| osm | class | type | geometry |
| W10 | highway | residential | 1 1, 1 1.001 |
When importing
Then W1 expands to no interpolation
Scenario: Ways with nodes without housenumbers are ignored
Given the grid
| 1 | | 2 |
| 4 | | 5 |
Given the places
| osm | class | type |
| N1 | place | house |
| N2 | place | house |
Given the places
| osm | class | type | housenr | geometry |
| W1 | place | houses | even | 1,2 |
And the named places
| osm | class | type | geometry |
| W10 | highway | residential | 4,5 |
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 |
| 4 | | | | | 5 |
Given the places
| 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,2 |
And the places
| osm | class | type | name | geometry |
| W10 | highway | residential | London Road |4,5 |
And the ways
| id | nodes |
| 1 | 1,2 |
When importing
Then W1 expands to interpolation
| start | end | geometry |
| 2 | 8 | 10,11 |
When reverse geocoding 1,1
Then the result contains
| object | type | display_name |
| N1 | house | 0, London Road |
Scenario: Parenting of interpolation with additional tags
Given the grid
| 1 | | | | | |
| | | | | | |
| | 8 | | | 9 | |
| | | | | | |
| 2 | | | | | 3 |
Given the places
| osm | class | type | housenr | addr+street |
| N8 | place | house | 10 | Horiz St |
| N9 | place | house | 16 | Horiz St |
And the places
| osm | class | type | name | geometry |
| W1 | highway | residential | Vert St | 1,2 |
| W2 | highway | residential | Horiz St | 2,3 |
And the places
| osm | class | type | addr+interpolation | addr+inclusion | geometry |
| W10 | place | houses | even | actual | 8,9 |
And the ways
| id | nodes |
| 10 | 8,9 |
When importing
Then placex contains
| object | parent_place_id |
| N8 | W2 |
| N9 | W2 |
And W10 expands to interpolation
| start | end | parent_place_id |
| 12 | 14 | W2 |
Scenario Outline: Bad interpolation values are ignored
Given the grid with origin 1,1
| 1 | | 9 | | 2 |
| 4 | | | | 5 |
Given the places
| osm | class | type | housenr |
| N1 | place | house | 2 |
| N2 | place | house | 6 |
And the places
| osm | class | type | addr+interpolation | geometry |
| W1 | place | houses | <value> | 1,2 |
And the named places
| osm | class | type | geometry |
| W10 | highway | residential | 4,5 |
And the ways
| id | nodes |
| 1 | 1,2 |
When importing
Then W1 expands to no interpolation
Examples:
| value |
| foo |
| x |
| 12-2 |
Scenario: Interpolation line where points have been moved (Github #3022)
Given the 0.00001 grid
| 1 | | | | | | | | 2 | 3 | 9 | | | | | | | | 4 |
Given the places
| osm | class | type | housenr | geometry |
| N1 | place | house | 2 | 1 |
| N2 | place | house | 18 | 3 |
| N3 | place | house | 24 | 9 |
| N4 | place | house | 42 | 4 |
And the places
| osm | class | type | addr+interpolation | geometry |
| W1 | place | houses | even | 1,2,3,4 |
And the named places
| osm | class | type | geometry |
| W10 | highway | residential | 1,4 |
And the ways
| id | nodes |
| 1 | 1,2,3,4 |
When importing
Then W1 expands to interpolation
| start | end |
| 4 | 16 |
| 20 | 22 |
| 26 | 40 |
Scenario: Interpolation line with duplicated points
Given the grid
| 7 | 10 | 8 | 11 | 9 |
| 4 | | | | 5 |
Given the places
| osm | class | type | housenr | geometry |
| N1 | place | house | 2 | 7 |
| N2 | place | house | 6 | 8 |
| N3 | place | house | 10 | 8 |
| N4 | place | house | 14 | 9 |
And the places
| osm | class | type | addr+interpolation | geometry |
| W1 | place | houses | even | 7,8,8,9 |
And the named places
| osm | class | type | geometry |
| W10 | highway | residential | 4,5 |
And the ways
| id | nodes |
| 1 | 1,2,3,4 |
When importing
Then W1 expands to interpolation
| start | end | geometry |
| 4 | 4 | 10 |
| 12 | 12 | 11 |
Scenario: Interpolaton line with broken way geometry (Github #2986)
Given the grid
| 1 | 8 | 10 | 11 | 9 | 2 | 3 | 4 |
Given the places
| osm | class | type | housenr |
| N1 | place | house | 2 |
| N2 | place | house | 8 |
| N3 | place | house | 12 |
| N4 | place | house | 14 |
And the places
| osm | class | type | addr+interpolation | geometry |
| W1 | place | houses | even | 8,9 |
And the named places
| osm | class | type | geometry |
| W10 | highway | residential | 1,4 |
And the ways
| id | nodes |
| 1 | 1,8,9,2,3,4 |
When importing
Then W1 expands to interpolation
| start | end | geometry |
| 4 | 6 | 10,11 |

View File

@@ -0,0 +1,332 @@
Feature: Linking of places
Tests for correctly determining linked places
Scenario: Only address-describing places can be linked
Given the grid
| 1 | | | | 2 |
| | | 9 | | |
| 4 | | | | 3 |
And the places
| osm | class | type | name | geometry |
| R13 | landuse | forest | Garbo | (1,2,3,4,1) |
| N256 | natural | peak | Garbo | 9 |
When importing
Then placex contains
| object | linked_place_id |
| R13 | - |
| N256 | - |
Scenario: Postcode areas cannot be linked
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 | 12345 | Q87493 | (1,2,3,4,1) |
| N25 | place | suburb | 12345 | Q87493 | 9 |
When importing
Then placex contains
| object | linked_place_id |
| R13 | - |
| N25 | - |
Scenario: Waterways are linked when in waterway relations
Given the grid
| 1 | | | | 3 | 4 | | | | 6 |
| | | 2 | | | 10 | | 5 | | |
| | | | | | 11 | | | | |
And the places
| osm | class | type | name | geometry |
| 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 |
When importing
Then placex contains
| object | linked_place_id |
| W1 | R13 |
| W2 | R13 |
| R13 | - |
| R23 | - |
When geocoding "rhein"
Then the result set contains
| object |
| R13 |
Scenario: Relations are not linked when in waterway relations
Given the grid
| 1 | | | | 3 | 4 | | | | 6 |
| | | 2 | | | 10 | | 5 | | |
| | | | | | 11 | | | | |
And the places
| osm | class | type | name | geometry |
| 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 |
When importing
Then placex contains
| object | linked_place_id |
| W1 | - |
| W2 | - |
| R1 | - |
| R2 | - |
When geocoding "rhein"
Then result 0 contains
| object |
| R1 |
And result 1 contains
| object |
| W2 |
Scenario: Empty waterway relations are handled correctly
Given the grid
| 1 | | | | 3 |
And the places
| osm | class | type | name | geometry |
| R1 | waterway | river | Rhein | 1,3 |
And the relations
| id | members | tags+type |
| 1 | | waterway |
When importing
Then placex contains
| object | linked_place_id |
| R1 | - |
Scenario: Waterways are not linked when the way type is not a river feature
Given the grid
| 1 | | 2 |
| | | |
| 3 | | 4 |
And the places
| osm | class | type | name | geometry |
| W1 | waterway | lock | Rhein | 3,4 |
| R1 | landuse | meadow | Rhein | (3,1,2,4,3) |
And the relations
| id | members | tags+type |
| 1 | W1,W2 | multipolygon |
When importing
Then placex contains
| object | linked_place_id |
| W1 | - |
| R1 | - |
Scenario: Side streams are linked only when they have the same name
Given the grid
| | | | | 8 | | | |
| 1 | | 2 | 3 | | 4 | 5 | 6|
| | | | | | 9 | | |
And the places
| osm | class | type | name | geometry |
| 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,W3 | waterway |
When importing
Then placex contains
| object | linked_place_id |
| W1 | - |
| W2 | R1 |
When geocoding "rhein2"
Then the result set contains
| object |
| W1 |
# 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 | (1,2,3,4,1) |
And the named places
| osm | class | type |
| N9 | natural | island |
| N9 | place | city |
And the relations
| id | members |
| 1 | N9:label |
When importing
Then placex contains
| object | linked_place_id |
| 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 | (1,2,3,4,1) |
| N2 | place | hamlet | 15 | Vario | 9 |
And the relations
| id | members | tags+type |
| 13 | N2:label | boundary |
When importing
Then placex contains
| object | linked_place_id |
| N2 | R13 |
And placex contains
| object | centroid!wkt | 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 | (1,2,3,4,1) |
And the places
| osm | class | type | name | geometry |
| N2 | place | city | Berlin | 9 |
When importing
Then placex contains
| object | linked_place_id |
| N2 | R13 |
And placex contains
| object | rank_address |
| R13 | 16 |
When geocoding ""
| city |
| Berlin |
Then result 0 contains
| object |
| R13 |
When geocoding ""
| state |
| Berlin |
Then result 0 contains
| object |
| R13 |
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 | (1,2,3,4,1) |
And the places
| osm | class | type | name | geometry |
| N2 | place | city | Berlin | 9 |
When importing
Then placex contains
| object | linked_place_id |
| N2 | - |
And placex contains
| object | rank_address |
| R13 | 8 |
When geocoding ""
| state |
| Berlin |
Then result 0 contains
| object |
| R13 |
When geocoding ""
| city |
| Berlin |
Then result 0 contains
| object |
| N2 |
# 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 | (1,2,3,4,1) |
And the named places
| osm | class | type | geometry |
| N2 | place | city | 9 |
And the relations
| id | members | tags+type |
| 13 | N2:label | boundary |
When importing
Then placex contains
| object | linked_place_id |
| N2 | R13 |
And placex contains
| object | centroid!in_box |
| R13 | 0,0,0.1,0.1 |
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 | 9 |
And the named places
| 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 |
| N2 | R1 |
And placex contains
| object | extratags!dict |
| R1 | 'linked_place' : 'city', 'wikidata': 'Q1234' |
| R2 | 'wikidata': 'Q1234' |
Scenario: Boundaries without names inherit names from linked places
Given the 0.05 grid
| 1 | | 2 |
| | 9 | |
| 4 | | 3 |
Given the places
| osm | class | type | extra+wikidata | admin | geometry |
| R1 | boundary | administrative | 34 | 8 | (1,2,3,4,1) |
And the places
| osm | class | type | name+name |
| N9 | place | city | LabelPlace |
And the relations
| id | members |
| 1 | N9:label |
When importing
Then placex contains
| object | name+_place_name |
| R1 | LabelPlace |
@skip
Scenario: Linked places expand default language names
Given the grid
| 1 | | 2 |
| | 9 | |
| 4 | | 3 |
Given the places
| osm | class | type | name+name | geometry |
| N9 | place | city | Popayán | 9 |
| R1 | boundary | administrative | Perímetro Urbano Popayán | (1,2,3,4,1) |
And the relations
| id | members |
| 1 | N9:label |
When importing
Then placex contains
| object | name+_place_name | name+_place_name:es |
| R1 | Popayán | Popayán |

View File

@@ -0,0 +1,104 @@
Feature: Import and search of names
Tests all naming related import issues
Scenario: No copying name tag if only one name
Given the places
| osm | class | type | name+name | geometry |
| N1 | place | locality | german | country:de |
When importing
Then placex contains
| object | country_code | name+name |
| N1 | de | german |
Scenario: Copying name tag to default language if it does not exist
Given the places
| osm | class | type | name+name | name+name:fi | geometry |
| N1 | place | locality | german | finnish | country:de |
When importing
Then placex contains
| object | country_code | name+name | name+name:fi | name+name:de |
| N1 | de | german | finnish | german |
Scenario: Copying default language name tag to name if it does not exist
Given the places
| osm | class | type | name+name:de | name+name:fi | geometry |
| N1 | place | locality | german | finnish | country:de |
When importing
Then placex contains
| object | country_code | name+name | name+name:fi | name+name:de |
| N1 | de | german | finnish | german |
Scenario: Do not overwrite default language with name tag
Given the places
| osm | class | type | name+name | name+name:fi | name+name:de | geometry |
| N1 | place | locality | german | finnish | local | country:de |
When importing
Then placex contains
| object | country_code | name+name | name+name:fi | name+name:de |
| N1 | de | german | finnish | local |
Scenario Outline: Names in any script can be found
Given the places
| osm | class | type | name+name |
| N1 | place | hamlet | <name> |
When importing
And geocoding "<name>"
Then the result set contains
| object |
| N1 |
Examples:
| name |
| Berlin |
| |
| Вологда |
| Αθήνα |
| القاهرة |
| |
| |
| |
Scenario: German umlauts can be found when expanded
Given the places
| osm | class | type | name+name:de |
| N1 | place | city | Münster |
| N2 | place | city | Köln |
| N3 | place | city | Gräfenroda |
When importing
When geocoding "münster"
Then the result set contains
| object |
| N1 |
When geocoding "muenster"
Then the result set contains
| object |
| N1 |
When geocoding "munster"
Then the result set contains
| object |
| N1 |
When geocoding "Köln"
Then the result set contains
| object |
| N2 |
When geocoding "Koeln"
Then the result set contains
| object |
| N2 |
When geocoding "Koln"
Then the result set contains
| object |
| N2 |
When geocoding "gräfenroda"
Then the result set contains
| object |
| N3 |
When geocoding "graefenroda"
Then the result set contains
| object |
| N3 |
When geocoding "grafenroda"
Then the result set contains
| object |
| N3 |

View File

@@ -0,0 +1,651 @@
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 grid with origin DE
| 10 | | | | | 11 |
| | | | | | |
| | 1 | | 2 | | |
And the places
| osm | class | type | housenr |
| N1 | place | house | 4 |
And the places
| osm | class | type | housenr | postcode |
| N2 | place | house | 5 | 99999 |
And the places
| osm | class | type | name | postcode | geometry |
| W1 | highway | residential | galoo | 12345 | 10,11 |
When importing
Then placex contains
| object | parent_place_id |
| N1 | W1 |
| N2 | W1 |
When geocoding "4 galoo"
Then result 0 contains
| object | display_name |
| N1 | 4, galoo, 12345, Deutschland |
When geocoding "5 galoo"
Then result 0 contains
| object | display_name |
| N2 | 5, galoo, 99999, Deutschland |
Scenario: Address without tags, closest street
Given the grid
| 10 | | | | | 11 |
| | 1 | 2 | | | |
| | | | 3 | 4 | |
| 20 | | | | | 21 |
And the places
| 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 | 10,11 |
| W2 | highway | residential | 20,21 |
When importing
Then placex contains
| object | parent_place_id |
| N1 | W1 |
| N2 | W1 |
| N3 | W2 |
| N4 | W2 |
Scenario: Address without tags avoids unnamed streets
Given the grid
| 10 | | | | | 11 |
| | 1 | 2 | | | |
| | | | 3 | 4 | |
| 20 | | | | | 21 |
And the places
| 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 | 20,21 |
When importing
Then placex contains
| object | parent_place_id |
| N1 | W2 |
| N2 | W2 |
| N3 | W2 |
| N4 | W2 |
Scenario: addr:street tag parents to appropriately named street
Given the grid
| 10 | | | | | 11 |
| | 1 | 2 | | | |
| | | | 3 | 4 | |
| 20 | | | | | 21 |
And the places
| 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 | 10,11 |
| W2 | highway | residential | south | 20,21 |
When importing
Then placex contains
| object | parent_place_id |
| N1 | W2 |
| N2 | W1 |
| N3 | W2 |
| N4 | W1 |
Scenario: addr:street tag parents to appropriately named street, locale names
Given the grid
| 10 | | | | | 11 |
| | 1 | 2 | | | |
| | | | 3 | 4 | |
| 20 | | | | | 21 |
And the places
| 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 | 10,11 |
| W2 | highway | residential | Süd | 20,21 |
When importing
Then placex contains
| object | parent_place_id |
| N1 | W2 |
| N2 | W1 |
| N3 | W2 |
| N4 | W1 |
Scenario: addr:street tag parents to appropriately named street with abbreviation
Given the grid
| 10 | | | | | 11 |
| | 1 | 2 | | | |
| | | | 3 | 4 | |
| 20 | | | | | 21 |
And the places
| 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 | 10,11 |
| W2 | highway | residential | south street | 20,21 |
When importing
Then placex contains
| object | parent_place_id |
| N1 | W2 |
| N2 | W1 |
| N3 | W2 |
| N4 | W1 |
Scenario: addr:street tag parents to next named street
Given the grid
| 10 | | | | | 11 |
| | 1 | 2 | | | |
| | | | 3 | 4 | |
| 20 | | | | | 21 |
And the places
| 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 | 10,11 |
| W2 | highway | residential | abcdef | 20,21 |
When importing
Then placex contains
| object | parent_place_id |
| N1 | W1 |
| N2 | W1 |
| N3 | W2 |
| N4 | W2 |
Scenario: addr:street tag without appropriately named street
Given the grid
| 10 | | | | | 11 |
| | 1 | | | | |
| | | | 3 | | |
| 20 | | | | | 21 |
And the places
| osm | class | type | street |
| N1 | place | house | abcdef |
| N3 | place | house | abcdef |
And the places
| osm | class | type | name | geometry |
| W1 | highway | residential | abcde | 10,11 |
| W2 | highway | residential | abcde | 20,21 |
When importing
Then placex contains
| object | parent_place_id |
| N1 | W1 |
| N3 | W2 |
Scenario: addr:place address
Given the grid
| 10 | | | |
| | 1 | | 2 |
| 11 | | | |
And the places
| osm | class | type | addr_place |
| N1 | place | house | myhamlet |
And the places
| osm | class | type | name | geometry |
| 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 grid
| 10 | | | |
| | | 1 | 2 |
| 11 | | | |
And the places
| osm | class | type | addr_place | street |
| N1 | place | house | myhamlet | mystreet|
And the places
| osm | class | type | name | geometry |
| 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 grid
| 10 | | | | | 11 |
| | 2 | | 3 | | |
| | | | | | |
| 12 | 1 | | | | |
And the places
| osm | class | type |
| N1 | place | house |
| N2 | place | house |
| N3 | place | house |
And the places
| osm | class | type | name | geometry |
| 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 |
When importing
Then placex contains
| object | parent_place_id |
| N1 | W1 |
| N2 | W1 |
| N3 | W1 |
Scenario: Avoid unnamed streets in simple associated street relation
Given the grid
| 10 | | | | | 11 |
| | 2 | | 3 | | |
| | | | | | |
| 12 | 1 | | | | |
And the places
| 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 | 10,11 |
And the relations
| id | members | tags+type |
| 1 | N1,N2,N3,W2:street,W1:street | associatedStreet |
When importing
Then placex contains
| object | parent_place_id |
| N1 | W1 |
| N2 | W1 |
| N3 | W1 |
Scenario: Associated street relation overrides addr:street
Given the grid
| 10 | | | | 11 |
| | | | | |
| | | 1 | | |
| | 20 | | 21 | |
And the places
| osm | class | type | street |
| N1 | place | house | bar |
And the places
| osm | class | type | name | geometry |
| W1 | highway | residential | foo | 10,11 |
| W2 | highway | residential | bar | 20,21 |
And the relations
| 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 grid
| 10 | | | | 11 |
| | | 1 | 2 | |
| 12 | | 4 | 3 | |
And the named places
| 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 grid
| 10 | | | | 11 |
| | | 1 | 2 | |
| 12 | | 4 | 3 | |
And the named places
| 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 | 10,11 |
| W3 | highway | residential | foo | 10,12 |
When importing
Then placex contains
| object | parent_place_id |
| W1 | W3 |
Scenario: Building with addr:place tags
Given the grid
| 10 | | | | |
| | 1 | 2 | | 9 |
| 11 | 4 | 3 | | |
And the places
| osm | class | type | name | geometry |
| 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 | (1,2,3,4,1) |
When importing
Then placex contains
| object | parent_place_id |
| W1 | N9 |
Scenario: Building in associated street relation
Given the grid
| 10 | | | | 11 |
| | | 1 | 2 | |
| 12 | | 4 | 3 | |
And the named places
| osm | class | type | geometry |
| W1 | building | yes | (1,2,3,4,1) |
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 |
When importing
Then placex contains
| object | parent_place_id |
| W1 | W3 |
Scenario: Building in associated street relation overrides addr:street
Given the grid
| 10 | | | | 11 |
| | | 1 | 2 | |
| 12 | | 4 | 3 | |
And the named places
| 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 | 10,11 |
| W3 | highway | residential | foo | 10,12 |
And the relations
| id | members | tags+type |
| 1 | W1:house,W2:street | associatedStreet |
When importing
Then placex contains
| object | parent_place_id |
| W1 | W2 |
Scenario: Wrong member in associated street relation is ignored
Given the grid
| 10 | | | | | | | 11 |
| | 1 | | 3 | 4 | | | |
| | | | 6 | 5 | | | |
And the named places
| osm | class | type | geometry |
| N1 | place | house | 11 |
And the named places
| osm | class | type | street | geometry |
| W1 | building | yes | foo | (3,4,5,6,3) |
And the places
| osm | class | type | name | geometry |
| W3 | highway | residential | foo | 10,11 |
And the relations
| id | members | tags+type |
| 1 | N1:house,W1:street,W3:street | associatedStreet |
When importing
Then placex contains
| object | parent_place_id |
| N1 | W3 |
Scenario: street member in associatedStreet relation can be a relation
Given the grid
| 1 | | | 2 |
| 3 | | | 4 |
| | | | |
| | 9 | | |
| 5 | | | 6 |
And the places
| osm | class | type | housenr | geometry |
| N9 | place | house | 34 | 9 |
And the named places
| osm | class | type | name | geometry |
| R14 | highway | pedestrian | Right St | (1,2,4,3,1) |
| W14 | highway | pedestrian | Left St | 5,6 |
And the relations
| id | members | tags+type |
| 1 | N9:house,R14:street | associatedStreet |
When importing
Then placex contains
| object | parent_place_id |
| N9 | R14 |
Scenario: Choose closest street in associatedStreet relation
Given the grid
| 1 | | | | 3 |
| 10 | | 11 | | 12 |
And the places
| osm | class | type | housenr | geometry |
| N1 | place | house | 1 | 1 |
| N3 | place | house | 3 | 3 |
And the named places
| osm | class | type | geometry |
| W100 | highway | residential | 10,11 |
| W101 | highway | residential | 11,12 |
And the relations
| id | members | tags+type |
| 1 | N1:house,N3:house,W100:street,W101:street | associatedStreet |
When importing
Then placex contains
| object | parent_place_id |
| N1 | W100 |
| N3 | W101 |
Scenario: POIs in building inherit address
Given the grid
| 10 | | | | | | 11 |
| | | 5 | 2 | 6 | | |
| | | 3 | 1 | | | |
| 12 | | 8 | | 7 | | |
And the named places
| osm | class | type |
| N1 | amenity | bank |
| N2 | shop | bakery |
| N3 | shop | supermarket|
And the places
| 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 | 10,11 |
| W3 | highway | residential | foo | 10,12 |
When importing
Then placex contains
| object | parent_place_id | housenumber |
| W1 | W3 | 3 |
| N1 | W3 | 3 |
| N2 | W3 | 3 |
| N3 | W3 | 3 |
When geocoding "3, foo"
Then the result set contains
| address+house_number |
| 3 |
Scenario: POIs don't inherit from streets
Given the grid
| 10 | | | | 11 |
| | 5 | 1 | 6 | |
| | 8 | | 7 | |
And the named places
| osm | class | type |
| N1 | amenity | bank |
And the places
| 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 | 10,11 |
When importing
Then placex contains
| object | parent_place_id | housenumber |
| N1 | W1 | None |
Scenario: POIs with own address do not inherit building address
Given the grid
| 10 | | | | | | 11 |
| | | 6 | 2 | 7 | | |
| | | 3 | 1 | | 5 | 4 |
| 12 | | 9 | | 8 | | |
And the named places
| osm | class | type | street |
| N1 | amenity | bank | bar |
And the named places
| osm | class | type | housenr |
| N2 | shop | bakery | 4 |
And the named places
| osm | class | type | addr_place |
| N3 | shop | supermarket| nowhere |
And the places
| 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 | (6,7,8,9,6) |
And the places
| osm | class | type | name | geometry |
| 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 | W2 | 4 |
| N3 | N5 | None |
Scenario: POIs parent a road if they are attached to it
Given the grid
| | 10 | |
| 20 | 1 | 21 |
| | 11 | |
And the named places
| osm | class | type |
| N1 | highway | bus_stop |
And the places
| osm | class | type | name | geometry |
| W1 | highway | secondary | North St | 10,11 |
| W2 | highway | unclassified | South St | 20,1,21 |
And the ways
| id | nodes |
| 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
| 1 | | 2 | 5 |
| | | | |
| 3 | | | 4 |
| | 10| | |
And the places
| osm | class | type | name+name | geometry |
| W1 | highway | residential | Via Cavassico superiore | 1, 2 |
| W3 | highway | residential | Via Cavassico superiore | 2, 5 |
| W2 | highway | primary | Via Frazione Cavassico | 3, 4 |
And the named places
| osm | class | type | addr+street |
| N10 | shop | yes | Via Cavassico superiore |
When importing
Then placex contains
| object | parent_place_id |
| N10 | W1 |
Scenario: place=square may be parented via addr:place
Given the grid
| | | 9 | | |
| | 5 | | 6 | |
| | 8 | | 7 | |
And the places
| osm | class | type | name+name | geometry |
| W2 | place | square | Foo pl | (5, 6, 7, 8, 5) |
And the places
| osm | class | type | name+name | housenr | addr_place | geometry |
| N10 | shop | grocery | le shop | 5 | Foo pl | 9 |
When importing
Then placex contains
| object | rank_address |
| W2 | 25 |
Then placex contains
| object | parent_place_id |
| N10 | W2 |

View File

@@ -0,0 +1,193 @@
Feature: Import into placex
Tests that data in placex is completed correctly.
Scenario: No country code tag is available
Given the named places
| osm | class | type | geometry |
| N1 | highway | primary | country:us |
When importing
Then placex contains
| object | address | country_code |
| N1 | - | us |
Scenario: Location overwrites country code tag
Given the named places
| osm | class | type | country | geometry |
| N1 | highway | primary | de | country:us |
When importing
Then placex contains
| object | addr+country | country_code |
| N1 | de | us |
Scenario: Country code tag overwrites location for countries
Given the named places
| osm | class | type | admin | country | geometry |
| R1 | boundary | administrative | 2 | de | (-100 40, -101 40, -101 41, -100 41, -100 40) |
When importing
Then placex contains
| object | rank_search| addr+country | country_code |
| R1 | 4 | de | de |
Scenario: Illegal country code tag for countries is ignored
Given the named places
| osm | class | type | admin | country | geometry |
| R1 | boundary | administrative | 2 | xx | (-100 40, -101 40, -101 41, -100 41, -100 40) |
When importing
Then placex contains
| object | addr+country | country_code |
| R1 | xx | us |
Scenario: admin level is copied over
Given the named places
| osm | class | type | admin |
| N1 | place | state | 3 |
When importing
Then placex contains
| object | admin_level |
| N1 | 3 |
Scenario: postcode node without postcode is dropped
Given the places
| osm | class | type | name+ref |
| N1 | place | postcode | 12334 |
When importing
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 | (1,2,3,1) |
When importing
Then placex has no entry for R1
Scenario: search and address ranks for boundaries are correctly assigned
Given the named places
| osm | class | type |
| N1 | boundary | administrative |
And the named places
| osm | class | type | geometry |
| W10 | boundary | administrative | 10 10, 11 11 |
And the named places
| osm | class | type | admin | geometry |
| R20 | boundary | administrative | 2 | (1 1, 2 2, 1 2, 1 1) |
| R21 | boundary | administrative | 32 | (3 3, 4 4, 3 4, 3 3) |
| R22 | boundary | nature_park | 6 | (0 0, 1 0, 0 1, 0 0) |
| R23 | boundary | natural_reserve| 10 | (0 0, 1 1, 1 0, 0 0) |
And the named places
| osm | class | type | geometry |
| R40 | place | country | (1 1, 2 2, 1 2, 1 1) |
| R41 | place | state | (3 3, 4 4, 3 4, 3 3) |
When importing
Then placex has no entry for N1
And placex has no entry for W10
And placex contains
| object | rank_search | rank_address |
| R20 | 4 | 4 |
| R21 | 25 | 0 |
| R22 | 25 | 0 |
| R23 | 25 | 0 |
| R40 | 4 | 0 |
| R41 | 8 | 0 |
Scenario: search and address ranks for highways correctly assigned
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 | 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 |
| N1 | 30 | 30 |
| W1 | 26 | 26 |
| W2 | 26 | 26 |
| W3 | 26 | 26 |
| W4 | 26 | 26 |
| W5 | 26 | 26 |
| 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,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 |
| N2 | 30 | 30 |
| W2 | 30 | 30 |
| W4 | 22 | 22 |
| R2 | 22 | 22 |
| 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 | 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 |
| N2 | 18 | 0 |
| N4 | 18 | 0 |
| N5 | 22 | 0 |
| W2 | 18 | 0 |
| R3 | 18 | 0 |
| R4 | 22 | 0 |
| R5 | 4 | 0 |
| R6 | 4 | 0 |
| 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 | (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 |
| R4 |
| R5 |
| R6 |
| W7 |
| R7 |

View File

@@ -0,0 +1,208 @@
Feature: Import of postcodes
Tests for postcode estimation
Scenario: Postcodes on the object are preferred over those on the address
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 | 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 | 11250 | 10,11 |
| N22 | building | yes | 11254 | 22 |
When importing
Then placex contains
| 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 grid with origin DE
| 10 | | | | 11 |
| | 1 | 2 | | |
| | 4 | 3 | | |
And the named places
| osm | class | type | addr+postcode | geometry |
| W93 | highway | residential | 86034 | 10,11 |
And the named places
| 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 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 | 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 | 10,11 |
When importing
Then placex contains
| object | postcode |
| W93 | 11200 |
Scenario: Postcodes from the lowest admin area with postcode are inherited by ways
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 | 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 | (1,4,3,2,1) |
And the named places
| osm | class | type | geometry |
| W93 | highway | residential | 10,11 |
When importing
Then placex contains
| object | postcode | parent_place_id |
| W93 | 11000 | R4 |
Scenario: Postcodes from the lowest admin area are inherited by buildings
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 | 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 | (10,11,12,13,10) |
When importing
Then placex contains
| object | postcode |
| W22 | 11200 |
Scenario: Roads get postcodes from nearby named buildings without other info
Given the grid with origin US
| 10 | | | | 11 |
| | 1 | 2 | | |
| | 4 | 3 | | |
And the named places
| osm | class | type | geometry |
| W93 | highway | residential | 10,11 |
And the named places
| osm | class | type | addr+postcode | geometry |
| W22 | building | yes | 45023 | (1,2,3,4,1) |
When importing
Then placex contains
| object | postcode |
| W93 | 45023 |
Scenario: Road areas get postcodes from nearby named buildings without other info
Given the grid with origin US
| 10 | | | | 11 |
| 13 | | | | 12 |
| | 1 | 2 | | |
| | 4 | 3 | | |
And the named places
| osm | class | type | geometry |
| W93 | highway | pedestriant | (10,11,12,13,10) |
And the named places
| osm | class | type | addr+postcode | geometry |
| W22 | building | yes | 45023 | (1,2,3,4,1) |
When importing
Then placex contains
| object | postcode |
| W93 | 45023 |
Scenario: Roads get postcodes from nearby unnamed buildings without other info
Given the grid with origin US
| 10 | | | | 11 |
| | 1 | 2 | | |
| | 4 | 3 | | |
And the named places
| osm | class | type | geometry |
| 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 | 45023 |
Scenario: Postcodes from admin boundaries are preferred over estimated postcodes
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 | 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 | 10,1 |
And the named places
| osm | class | type | addr+postcode |
| N22 | building | yes | 45023 |
When importing
Then placex contains
| object | postcode |
| W93 | 11200 |
Scenario: Postcodes are added to the postcode
Given the places
| osm | class | type | addr+postcode | addr+housenumber | geometry |
| N34 | place | house | 01982 | 111 |country:de |
When importing
Then location_postcode contains exactly
| country_code | postcode | geometry!wkt |
| de | 01982 | country:de |
@skip
Scenario: search and address ranks for GB post codes correctly assigned
Given the places
| osm | class | type | postcode | geometry |
| N1 | place | postcode | E45 2CD | country:gb |
| N2 | place | postcode | E45 2 | country:gb |
| N3 | place | postcode | Y45 | country:gb |
When importing
Then location_postcode contains exactly
| postcode | country_code | rank_search | rank_address |
| E45 2CD | gb | 25 | 5 |
| E45 2 | gb | 23 | 5 |
| Y45 | gb | 21 | 5 |
Scenario: Postcodes outside all countries are not added to the postcode table
Given the places
| osm | class | type | addr+postcode | addr+housenumber | addr+place | geometry |
| N34 | place | house | 01982 | 111 | Null Island | 0 0.00001 |
And the places
| osm | class | type | name | geometry |
| N1 | place | hamlet | Null Island | 0 0 |
When importing
Then location_postcode contains exactly
| place_id |
When geocoding "111, 01982 Null Island"
Then the result set contains
| object | display_name |
| N34 | 111, Null Island, 01982 |

View File

@@ -0,0 +1,295 @@
Feature: Rank assignment
Tests for assignment of search and address ranks.
Scenario: Ranks for place nodes are assigned according to their type
Given the named places
| osm | class | type | geometry |
| N1 | foo | bar | 0 0 |
| N11 | place | Continent | 0 0 |
| N12 | place | continent | 0 0 |
| N13 | place | sea | 0 0 |
| N14 | place | country | 0 0 |
| N15 | place | state | 0 0 |
| N16 | place | region | 0 0 |
| N17 | place | county | 0 0 |
| N18 | place | city | 0 0 |
| N19 | place | island | 0 0 |
| N36 | place | house | 0 0 |
And the named places
| osm | class | type | extra+capital | geometry |
| N101 | place | city | yes | 0 0 |
When importing
Then placex contains
| object | rank_search | rank_address |
| N1 | 30 | 30 |
| N11 | 22 | 0 |
| N12 | 2 | 0 |
| N13 | 2 | 0 |
| N14 | 4 | 0 |
| N15 | 8 | 0 |
| N16 | 18 | 0 |
| N17 | 12 | 12 |
| N18 | 16 | 16 |
| N19 | 17 | 0 |
| N101 | 15 | 16 |
| N36 | 30 | 30 |
Scenario: Ranks for boundaries are assigned according to admin level
Given the named places
| osm | class | type | admin | geometry |
| R20 | boundary | administrative | 2 | (1 1, 2 2, 1 2, 1 1) |
| R21 | boundary | administrative | 32 | (3 3, 4 4, 3 4, 3 3) |
| R22 | boundary | administrative | 6 | (0 0, 1 0, 0 1, 0 0) |
| R23 | boundary | administrative | 10 | (0 0, 1 1, 1 0, 0 0) |
When importing
Then placex contains
| object | rank_search | rank_address |
| R20 | 4 | 4 |
| R21 | 25 | 0 |
| R22 | 12 | 12 |
| R23 | 20 | 20 |
Scenario: Ranks for addressable boundaries with place assignment go with place address ranks if available
Given the named places
| osm | class | type | admin | extra+place | geometry |
| R20 | boundary | administrative | 3 | state | (1 1, 2 2, 1 2, 1 1) |
| R21 | boundary | administrative | 32 | suburb | (3 3, 4 4, 3 4, 3 3) |
| R22 | boundary | administrative | 6 | town | (0 0, 1 0, 0 1, 0 0) |
| R23 | boundary | administrative | 10 | village | (0 0, 1 1, 1 0, 0 0) |
When importing
Then placex contains
| object | rank_search | rank_address |
| R20 | 6 | 6 |
| R21 | 25 | 0 |
| R22 | 12 | 16 |
| R23 | 20 | 16 |
Scenario: Place address ranks cannot overtake a parent address rank
Given the named places
| osm | class | type | admin | extra+place | geometry |
| R20 | boundary | administrative | 8 | town | (0 0, 0 2, 2 2, 2 0, 0 0) |
| R21 | boundary | administrative | 9 | municipality | (0 0, 0 1, 1 1, 1 0, 0 0) |
| R22 | boundary | administrative | 9 | suburb | (0 0, 0 1, 1 1, 1 0, 0 0) |
When importing
Then placex contains
| object | rank_search | rank_address |
| R20 | 16 | 16 |
| R21 | 18 | 18 |
| R22 | 18 | 20 |
Then place_addressline contains
| object | address | cached_rank_address |
| R21 | R20 | 16 |
| R22 | R20 | 16 |
Scenario: Admin levels cannot overtake each other due to place address ranks
Given the named places
| osm | class | type | admin | extra+place | geometry |
| R20 | boundary | administrative | 6 | town | (0 0, 0 2, 2 2, 2 0, 0 0) |
| R21 | boundary | administrative | 8 | | (0 0, 0 1, 1 1, 1 0, 0 0) |
| R22 | boundary | administrative | 8 | suburb | (0 0, 0 1, 1 1, 1 0, 0 0) |
When importing
Then placex contains
| object | rank_search | rank_address |
| R20 | 12 | 16 |
| R21 | 16 | 18 |
| R22 | 16 | 20 |
Then place_addressline contains
| object | address | cached_rank_address |
| R21 | R20 | 16 |
| R22 | R20 | 16 |
Scenario: Admin levels cannot overtake each other due to place address ranks even when slightly misaligned
Given the named places
| osm | class | type | admin | extra+place | geometry |
| R20 | boundary | administrative | 6 | town | (0 0, 0 2, 2 2, 2 0, 0 0) |
| R21 | boundary | administrative | 8 | | (0 0, -0.0001 1, 1 1, 1 0, 0 0) |
When importing
Then placex contains
| object | rank_search | rank_address |
| R20 | 12 | 16 |
| R21 | 16 | 18 |
Then place_addressline contains
| object | address | cached_rank_address |
| R21 | R20 | 16 |
Scenario: Admin levels must not be larger than 25
Given the named places
| osm | class | type | admin | extra+place | geometry |
| R20 | boundary | administrative | 6 | neighbourhood | (0 0, 0 2, 2 2, 2 0, 0 0) |
| R21 | boundary | administrative | 7 | | (0 0, 0 1, 1 1, 1 0, 0 0) |
| R22 | boundary | administrative | 8 | | (0 0, 0 0.5, 0.5 0.5, 0.5 0, 0 0) |
When importing
Then placex contains
| object | rank_search | rank_address |
| R20 | 12 | 22 |
| R21 | 14 | 24 |
| R22 | 16 | 25 |
Scenario: admin levels contained in a place area must not overtake address ranks
Given the named places
| osm | class | type | admin | geometry |
| R10 | place | city | 15 | (0 0, 0 2, 2 0, 0 0) |
| R20 | boundary | administrative | 6 | (0 0, 0 1, 1 0, 0 0) |
When importing
Then placex contains
| object | rank_search | rank_address |
| R10 | 16 | 16 |
| R20 | 12 | 18 |
Scenario: admin levels overlapping a place area are not demoted
Given the named places
| osm | class | type | admin | geometry |
| R10 | place | city | 15 | (0 0, 0 2, 2 0, 0 0) |
| R20 | boundary | administrative | 6 | (-1 0, 0 1, 1 0, -1 0) |
When importing
Then placex contains
| object | rank_search | rank_address |
| R10 | 16 | 16 |
| R20 | 12 | 12 |
Scenario: admin levels with equal area as a place area are not demoted
Given the named places
| osm | class | type | admin | geometry |
| R10 | place | city | 15 | (0 0, 0 2, 2 0, 0 0) |
| R20 | boundary | administrative | 6 | (0 0, 0 2, 2 0, 0 0) |
When importing
Then placex contains
| object | rank_search | rank_address |
| R10 | 16 | 16 |
| R20 | 12 | 12 |
Scenario: adjacent admin_levels are considered the same object when they have the same wikidata
Given the named places
| osm | class | type | admin | extra+wikidata | geometry |
| N20 | place | square | 15 | Q123 | 0.1 0.1 |
| R23 | boundary | administrative | 10 | Q444 | (0 0, 0 1, 1 1, 1 0, 0 0) |
| R21 | boundary | administrative | 9 | Q444 | (0 0, 0 1, 1 1, 1 0, 0 0) |
| R22 | boundary | administrative | 8 | Q444 | (0 0, 0 1, 1 1, 1 0, 0 0) |
When importing
Then placex contains
| object | rank_search | rank_address |
| R23 | 20 | 0 |
| R21 | 18 | 0 |
| R22 | 16 | 16 |
Then place_addressline contains exactly
| object | address | cached_rank_address |
| N20 | R22 | 16 |
Scenario: adjacent admin_levels are considered different objects when they have different wikidata
Given the named places
| osm | class | type | admin | extra+wikidata | geometry |
| N20 | place | square | 15 | Q123 | 0.1 0.1 |
| R21 | boundary | administrative | 9 | Q4441 | (0 0, 0 1, 1 1, 1 0, 0 0) |
| R22 | boundary | administrative | 8 | Q444 | (0 0, 0 1, 1 1, 1 0, 0 0) |
When importing
Then placex contains
| object | rank_search | rank_address |
| R21 | 18 | 18 |
| R22 | 16 | 16 |
Then place_addressline contains
| object | address | cached_rank_address |
| N20 | R22 | 16 |
| N20 | R21 | 18 |
Scenario: Mixes of admin boundaries and place areas I
Given the grid
| 1 | | 10 | | | 2 |
| | 9 | | | | |
| 20| | 21 | | | |
| 4 | | 11 | | | 3 |
And the places
| osm | class | type | admin | name | geometry |
| R1 | boundary | administrative | 5 | Greater London | (1,2,3,4,1) |
| R2 | boundary | administrative | 8 | Kensington | (1,10,11,4,1) |
And the places
| osm | class | type | name | geometry |
| R10 | place | city | London | (1,2,3,4,1) |
| N9 | place | town | Fulham | 9 |
| W1 | highway | residential | Lots Grove | 20,21 |
When importing
Then placex contains
| object | rank_search | rank_address |
| R1 | 10 | 10 |
| R10 | 16 | 16 |
| R2 | 16 | 18 |
| N9 | 18 | 18 |
And place_addressline contains
| object | address | isaddress | cached_rank_address |
| W1 | R1 | True | 10 |
| W1 | R10 | True | 16 |
| W1 | R2 | True | 18 |
| W1 | N9 | False | 18 |
Scenario: Mixes of admin boundaries and place areas II
Given the grid
| 1 | | 10 | | 5 | 2 |
| | 9 | | | | |
| 20| | 21 | | | |
| 4 | | 11 | | 6 | 3 |
And the places
| osm | class | type | admin | name | geometry |
| R1 | boundary | administrative | 5 | Greater London | (1,2,3,4,1) |
| R2 | boundary | administrative | 8 | London | (1,5,6,4,1) |
And the places
| osm | class | type | name | geometry |
| R10 | place | city | Westminster | (1,10,11,4,1) |
| N9 | place | town | Fulham | 9 |
| W1 | highway | residential | Lots Grove | 20,21 |
When importing
Then placex contains
| object | rank_search | rank_address |
| R1 | 10 | 10 |
| R2 | 16 | 16 |
| R10 | 16 | 18 |
| N9 | 18 | 18 |
And place_addressline contains
| object | address | isaddress | cached_rank_address |
| W1 | R1 | True | 10 |
| W1 | R10 | True | 18 |
| W1 | R2 | True | 16 |
| W1 | N9 | False | 18 |
Scenario: POI nodes with place tags
Given the places
| osm | class | type | name | extratags |
| N23 | amenity | playground | AB | "place": "city" |
| N23 | place | city | AB | "amenity": "playground" |
When importing
Then placex contains exactly
| object | rank_search | rank_address |
| N23:amenity | 30 | 30 |
| N23:place | 16 | 16 |
Scenario: Address rank 25 is only used for addr:place
Given the grid
| 10 | 33 | 34 | 11 |
Given the places
| osm | class | type | name |
| N10 | place | village | vil |
| N11 | place | farm | farm |
And the places
| osm | class | type | name | geometry |
| W1 | highway | residential | RD | 33,11 |
And the places
| osm | class | type | name | addr+farm | geometry |
| W2 | highway | residential | RD2 | farm | 34,11 |
And the places
| osm | class | type | housenr |
| N33 | place | house | 23 |
And the places
| osm | class | type | housenr | addr+place |
| N34 | place | house | 23 | farm |
When importing
Then placex contains
| object | parent_place_id |
| N11 | N10 |
| N33 | W1 |
| N34 | N11 |
And place_addressline contains
| object | address |
| W1 | N10 |
| W2 | N10 |
| W2 | N11 |

View File

@@ -0,0 +1,389 @@
Feature: Creation of search terms
Tests that search_name table is filled correctly
Scenario: Semicolon-separated names appear as separate full names
Given the places
| osm | class | type | name+alt_name |
| N1 | place | city | New York; Big Apple |
| N2 | place | town | New York Big Apple |
When importing
And geocoding "New York Big Apple"
Then result 0 contains
| object |
| N2 |
Scenario: Comma-separated names appear as a single full name
Given the places
| osm | class | type | name+name |
| N1 | place | city | New York, Big Apple |
| N2 | place | town | New York Big Apple |
When importing
And geocoding "New York Big Apple"
Then result 0 contains
| object |
| N1 |
Scenario: Name parts before brackets appear as full names
Given the places
| osm | class | type | name+name |
| N1 | place | city | Halle (Saale) |
| N2 | place | town | Halle |
When importing
And geocoding "Halle"
Then result 0 contains
| object |
| N1 |
When geocoding "Halle (Saale)"
Then the result set contains
| object |
| N1 |
Scenario: Unknown addr: tags can be found for unnamed POIs
Given the grid
| | 1 | | |
| 10 | | | 11 |
And the places
| 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 | 10,11 |
When importing
When geocoding "23 Rose Street, Walltown"
Then the result set contains
| object | display_name |
| N1 | 23, Rose Street |
When geocoding "Walltown, Rose Street 23"
Then the result set contains
| object | display_name |
| N1 | 23, Rose Street |
When geocoding "Rose Street 23, Walltown"
Then the result set contains
| object | display_name |
| N1 | 23, Rose Street |
Scenario: Searching for unknown addr: tags also works for multiple words
Given the grid
| | 1 | | |
| 10 | | | 11 |
And the places
| 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 | 10,11 |
When importing
When geocoding "23 Rose Street, Little Big Town"
Then the result set contains
| object | display_name |
| N1 | 23, Rose Street |
When geocoding "Rose Street 23, Little Big Town"
Then the result set contains
| object | display_name |
| N1 | 23, Rose Street |
When geocoding "Little big Town, Rose Street 23"
Then the result set contains
| object | display_name |
| N1 | 23, Rose Street |
Scenario: Unnamed POI can be found when it has known addr: tags
Given the grid
| | 1 | | |
| 10 | | | 11 |
And the places
| 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 | 10,11 |
When importing
When geocoding "23 Rose Street, Walltown"
Then the result set contains
| object | display_name |
| N1 | 23, Rose Street |
Scenario: Unnamed POIs inherit parent name when unknown addr:place is present
Given the grid
| 100 | | | | | 101 |
| | | 1 | | | |
| 103 | 10 | | | 11 | 102 |
And the places
| 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 | 10,11 |
| R1 | place | city | Strange Town | (100,101,102,103,100) |
When importing
Then placex contains
| object | parent_place_id |
| N1 | R1 |
When geocoding "23 Rose Street"
Then all results contain
| object | display_name |
| W1 | Rose Street, Strange Town |
When geocoding "23 Walltown, Strange Town"
Then the result set contains
| object | display_name |
| N1 | 23, Walltown, Strange Town |
When geocoding "Walltown 23, Strange Town"
Then the result set contains
| object | display_name |
| N1 | 23, Walltown, Strange Town |
When geocoding "Strange Town, Walltown 23"
Then the result set contains
| object | display_name |
| N1 | 23, Walltown, Strange Town |
Scenario: Named POIs can be searched by housenumber when unknown addr:place is present
Given the grid
| 100 | | | | | 101 |
| | | 1 | | | |
| 103 | 10 | | | 11 | 102 |
And the places
| 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 | 10,11 |
| R1 | place | city | Strange Town | (100,101,102,103,100) |
When importing
When geocoding "23 Walltown, Strange Town"
Then the result set contains
| object | display_name |
| N1 | Blue house, 23, Walltown, Strange Town |
When geocoding "Walltown 23, Strange Town"
Then the result set contains
| object | display_name |
| N1 | Blue house, 23, Walltown, Strange Town |
When geocoding "Strange Town, Walltown 23"
Then the result set contains
| object | display_name |
| N1 | Blue house, 23, Walltown, Strange Town |
When geocoding "Strange Town, Walltown 23, Blue house"
Then the result set contains
| object | display_name |
| N1 | Blue house, 23, Walltown, Strange Town |
When geocoding "Strange Town, Walltown, Blue house"
Then the result set contains
| object | display_name |
| N1 | Blue house, 23, Walltown, Strange Town |
Scenario: Named POIs can be found when unknown multi-word addr:place is present
Given the grid
| 100 | | | | | 101 |
| | | 1 | | | |
| 103 | 10 | | | 11 | 102 |
And the places
| 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 | 10,11 |
| R1 | place | city | Strange Town | (100,101,102,103,100) |
When importing
When geocoding "23 Moon Sun, Strange Town"
Then the result set contains
| object | display_name |
| N1 | Blue house, 23, Moon sun, Strange Town |
When geocoding "Blue house, Moon Sun, Strange Town"
Then the result set contains
| object | display_name |
| 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 grid
| 100 | | | | | 101 |
| | | 1 | | | |
| 103 | 10 | | | 11 | 102 |
And the places
| 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 | 10,11 |
| R1 | place | suburb | Strange Town | Walltown | (100,101,102,103,100) |
When importing
When geocoding "23 Rose Street, Walltown"
Then all results contain
| object | display_name |
| W1 | Rose Street, Strange Town |
When geocoding "23 Walltown"
Then all results contain
| object | display_name |
| N1 | 23, Walltown, Strange Town |
Scenario: Unnamed POIs does inherit parent name when unknown addr:place and addr:street is present
Given the grid
| | 1 | | |
| 10 | | | 11 |
And the places
| 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 | 10,11 |
When importing
When geocoding "23 Rose Street"
Then the result set contains
| object | display_name |
| N1 | 23, Rose Street |
When geocoding "23 Lily Street"
Then exactly 0 results are returned
Scenario: An unknown addr:street is ignored
Given the grid
| | 1 | | |
| 10 | | | 11 |
And the places
| 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 | 10,11 |
When importing
When geocoding "23 Rose Street"
Then the result set contains
| object | display_name |
| N1 | 23, Rose Street |
When geocoding "23 Lily Street"
Then exactly 0 results are returned
Scenario: Named POIs can be found through unknown address tags
Given the grid
| | 1 | | |
| 10 | | | 11 |
And the places
| 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 | 10,11 |
When importing
When geocoding "Green Moss, Rose Street, Walltown"
Then the result set contains
| object | display_name |
| N1 | Green Moss, 26, Rose Street |
When geocoding "Green Moss, 26, Rose Street, Walltown"
Then the result set contains
| object | display_name |
| N1 | Green Moss, 26, Rose Street |
When geocoding "26, Rose Street, Walltown"
Then the result set contains
| object | display_name |
| N1 | Green Moss, 26, Rose Street |
When geocoding "Rose Street 26, Walltown"
Then the result set contains
| object | display_name |
| N1 | Green Moss, 26, Rose Street |
When geocoding "Walltown, Rose Street 26"
Then the result set contains
| object | display_name |
| 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 grid
| 100 | | | | | 101 |
| | | 1 | | | |
| 103 | 10 | | | 11 | 102 |
And the places
| 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 | 10,11 |
| R1 | place | suburb | Strange Town | (100,101,102,103,100) |
When importing
When geocoding "Green Moss, Rose Street, Walltown"
Then exactly 0 results are returned
When geocoding "Green Moss, Walltown"
Then the result set contains
| object | display_name |
| N1 | Green Moss, Walltown, Strange Town |
Scenario: Named POIs inherit address from parent
Given the grid
| | 1 | | |
| 10 | | | 11 |
And the places
| osm | class | type | name | geometry |
| N1 | place | house | foo | 1 |
| W1 | highway | residential | the road | 10,11 |
When importing
When geocoding "foo, the road"
Then all results contain
| object |
| N1 |
Scenario: Some addr: tags are added to address
Given the grid
| | 2 | 3 | |
| 10 | | | 11 |
And the places
| osm | class | type | name |
| N2 | place | city | bonn |
| N3 | place | suburb | smalltown|
And the places
| osm | class | type | name | addr+city | addr+municipality | addr+suburb | geometry |
| W1 | highway | service | the end | bonn | New York | Smalltown | 10,11 |
When importing
When geocoding "the end, new york, bonn, smalltown"
Then all results contain
| object |
| W1 |
Scenario: A known addr:* tag is added even if the name is unknown
Given the grid
| 10 | | | | 11 |
And the places
| osm | class | type | name | addr+city | geometry |
| W1 | highway | residential | Road | Nandu | 10,11 |
When importing
And geocoding "Road, Nandu"
Then all results contain
| object |
| W1 |
Scenario: a linked place does not show up in search name
Given the 0.01 grid
| 10 | | 11 |
| | 2 | |
| 13 | | 12 |
Given the places
| osm | class | type | name | admin | geometry |
| R13 | boundary | administrative | Roma | 9 | (10,11,12,13,10) |
And the places
| osm | class | type | name |
| N2 | place | city | Cite |
And the relations
| id | members | tags+type |
| 13 | N2:label | boundary |
When importing
Then placex contains
| object | linked_place_id |
| N2 | R13 |
When geocoding "Cite"
Then all results contain
| object |
| R13 |
Scenario: a linked waterway does not show up in search name
Given the grid
| 1 | | 2 | | 3 |
And the places
| osm | class | type | name | geometry |
| 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 |
When importing
Then placex contains
| object | linked_place_id |
| W1 | R13 |
| W2 | R13 |
When geocoding "Rhein"
Then all results contain
| object |
| R13 |