mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-16 15:47:58 +00:00
add functional tests
These are the tests that were formerly located at https://github.com/lonvia/test-nominatim
This commit is contained in:
98
tests/features/db/import/linking.feature
Normal file
98
tests/features/db/import/linking.feature
Normal file
@@ -0,0 +1,98 @@
|
||||
@DB
|
||||
Feature: Linking of places
|
||||
Tests for correctly determining linked places
|
||||
|
||||
Scenario: Waterways are linked when in waterway relations
|
||||
Given the scene split-road
|
||||
And the place ways
|
||||
| osm_type | osm_id | class | type | name | geometry
|
||||
| W | 1 | waterway | river | Rhein | :w-2
|
||||
| W | 2 | waterway | river | Rhein | :w-3
|
||||
| R | 13 | waterway | river | Rhein | :w-1 + :w-2 + :w-3
|
||||
| R | 23 | waterway | river | Limmat| :w-4a
|
||||
And the relations
|
||||
| id | members | tags
|
||||
| 13 | R23:tributary,W1,W2:main_stream | 'type' : 'waterway'
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | linked_place_id
|
||||
| W1 | R13
|
||||
| W2 | R13
|
||||
| R13 | None
|
||||
| R23 | None
|
||||
When sending query "rhein"
|
||||
Then results contain
|
||||
| osm_type
|
||||
| R
|
||||
|
||||
Scenario: Relations are not linked when in waterway relations
|
||||
Given the scene split-road
|
||||
And the place ways
|
||||
| osm_type | osm_id | class | type | name | geometry
|
||||
| W | 1 | waterway | river | Rhein | :w-2
|
||||
| W | 2 | waterway | river | Rhein | :w-3
|
||||
| R | 1 | waterway | river | Rhein | :w-1 + :w-2 + :w-3
|
||||
| R | 2 | waterway | river | Limmat| :w-4a
|
||||
And the relations
|
||||
| id | members | tags
|
||||
| 1 | R2 | 'type' : 'waterway'
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | linked_place_id
|
||||
| W1 | None
|
||||
| W2 | None
|
||||
| R1 | None
|
||||
| R2 | None
|
||||
|
||||
Scenario: Empty waterway relations are handled correctly
|
||||
Given the scene split-road
|
||||
And the place ways
|
||||
| osm_type | osm_id | class | type | name | geometry
|
||||
| R | 1 | waterway | river | Rhein | :w-1 + :w-2 + :w-3
|
||||
And the relations
|
||||
| id | members | tags
|
||||
| 1 | | 'type' : 'waterway'
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | linked_place_id
|
||||
| R1 | None
|
||||
|
||||
Scenario: Waterways are not linked when waterway types don't match
|
||||
Given the scene split-road
|
||||
And the place ways
|
||||
| osm_type | osm_id | class | type | name | geometry
|
||||
| W | 1 | waterway | drain | Rhein | :w-2
|
||||
| R | 1 | waterway | river | Rhein | :w-1 + :w-2 + :w-3
|
||||
And the relations
|
||||
| id | members | tags
|
||||
| 1 | N23,N34,W1,R45 | 'type' : 'multipolygon'
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | linked_place_id
|
||||
| W1 | None
|
||||
| R1 | None
|
||||
When sending query "rhein"
|
||||
Then results contain
|
||||
| ID | osm_type
|
||||
| 0 | R
|
||||
| 1 | W
|
||||
|
||||
Scenario: Side streams are linked only when they have the same name
|
||||
Given the scene split-road
|
||||
And the place ways
|
||||
| osm_type | osm_id | class | type | name | geometry
|
||||
| W | 1 | waterway | river | Rhein2 | :w-2
|
||||
| W | 2 | waterway | river | Rhein | :w-3
|
||||
| R | 1 | waterway | river | Rhein | :w-1 + :w-2 + :w-3
|
||||
And the relations
|
||||
| id | members | tags
|
||||
| 1 | W1:side_stream,W2:side_stream | 'type' : 'waterway'
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | linked_place_id
|
||||
| W1 | None
|
||||
| W2 | R1
|
||||
When sending query "rhein2"
|
||||
Then results contain
|
||||
| osm_type
|
||||
| W
|
||||
202
tests/features/db/import/naming.feature
Normal file
202
tests/features/db/import/naming.feature
Normal file
@@ -0,0 +1,202 @@
|
||||
@DB
|
||||
Feature: Import and search of names
|
||||
Tests all naming related issues: normalisation,
|
||||
abbreviations, internationalisation, etc.
|
||||
|
||||
|
||||
Scenario: Case-insensitivity of search
|
||||
Given the place nodes
|
||||
| osm_id | class | type | name
|
||||
| 1 | place | locality | 'name' : 'FooBar'
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | class | type | name
|
||||
| N1 | place | locality | 'name' : 'FooBar'
|
||||
When sending query "FooBar"
|
||||
Then results contain
|
||||
| ID | osm_type | osm_id
|
||||
| 0 | N | 1
|
||||
When sending query "foobar"
|
||||
Then results contain
|
||||
| ID | osm_type | osm_id
|
||||
| 0 | N | 1
|
||||
When sending query "fOObar"
|
||||
Then results contain
|
||||
| ID | osm_type | osm_id
|
||||
| 0 | N | 1
|
||||
When sending query "FOOBAR"
|
||||
Then results contain
|
||||
| ID | osm_type | osm_id
|
||||
| 0 | N | 1
|
||||
|
||||
Scenario: Multiple spaces in name
|
||||
Given the place nodes
|
||||
| osm_id | class | type | name
|
||||
| 1 | place | locality | 'name' : 'one two three'
|
||||
When importing
|
||||
When sending query "one two three"
|
||||
Then results contain
|
||||
| ID | osm_type | osm_id
|
||||
| 0 | N | 1
|
||||
When sending query "one two three"
|
||||
Then results contain
|
||||
| ID | osm_type | osm_id
|
||||
| 0 | N | 1
|
||||
When sending query "one two three"
|
||||
Then results contain
|
||||
| ID | osm_type | osm_id
|
||||
| 0 | N | 1
|
||||
When sending query " one two three"
|
||||
Then results contain
|
||||
| ID | osm_type | osm_id
|
||||
| 0 | N | 1
|
||||
|
||||
Scenario: Special characters in name
|
||||
Given the place nodes
|
||||
| osm_id | class | type | name
|
||||
| 1 | place | locality | 'name' : 'Jim-Knopf-Str'
|
||||
| 2 | place | locality | 'name' : 'Smith/Weston'
|
||||
| 3 | place | locality | 'name' : 'space mountain'
|
||||
| 4 | place | locality | 'name' : 'space'
|
||||
| 5 | place | locality | 'name' : 'mountain'
|
||||
When importing
|
||||
When sending query "Jim-Knopf-Str"
|
||||
Then results contain
|
||||
| ID | osm_type | osm_id
|
||||
| 0 | N | 1
|
||||
When sending query "Jim Knopf-Str"
|
||||
Then results contain
|
||||
| ID | osm_type | osm_id
|
||||
| 0 | N | 1
|
||||
When sending query "Jim Knopf Str"
|
||||
Then results contain
|
||||
| ID | osm_type | osm_id
|
||||
| 0 | N | 1
|
||||
When sending query "Jim/Knopf-Str"
|
||||
Then results contain
|
||||
| ID | osm_type | osm_id
|
||||
| 0 | N | 1
|
||||
When sending query "Jim-Knopfstr"
|
||||
Then results contain
|
||||
| ID | osm_type | osm_id
|
||||
| 0 | N | 1
|
||||
When sending query "Smith/Weston"
|
||||
Then results contain
|
||||
| ID | osm_type | osm_id
|
||||
| 0 | N | 2
|
||||
When sending query "Smith Weston"
|
||||
Then results contain
|
||||
| ID | osm_type | osm_id
|
||||
| 0 | N | 2
|
||||
When sending query "Smith-Weston"
|
||||
Then results contain
|
||||
| ID | osm_type | osm_id
|
||||
| 0 | N | 2
|
||||
When sending query "space mountain"
|
||||
Then results contain
|
||||
| ID | osm_type | osm_id
|
||||
| 0 | N | 3
|
||||
When sending query "space-mountain"
|
||||
Then results contain
|
||||
| ID | osm_type | osm_id
|
||||
| 0 | N | 3
|
||||
When sending query "space/mountain"
|
||||
Then results contain
|
||||
| ID | osm_type | osm_id
|
||||
| 0 | N | 3
|
||||
When sending query "space\mountain"
|
||||
Then results contain
|
||||
| ID | osm_type | osm_id
|
||||
| 0 | N | 3
|
||||
When sending query "space(mountain)"
|
||||
Then results contain
|
||||
| ID | osm_type | osm_id
|
||||
| 0 | N | 3
|
||||
|
||||
Scenario: No copying name tag if only one name
|
||||
Given the place nodes
|
||||
| osm_id | class | type | name | geometry
|
||||
| 1 | place | locality | 'name' : 'german' | country:de
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | calculated_country_code |
|
||||
| N1 | de
|
||||
And table placex contains as names for N1
|
||||
| object | k | v
|
||||
| N1 | name | german
|
||||
|
||||
Scenario: Copying name tag to default language if it does not exist
|
||||
Given the place nodes
|
||||
| osm_id | class | type | name | geometry
|
||||
| 1 | place | locality | 'name' : 'german', 'name:fi' : 'finnish' | country:de
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | calculated_country_code |
|
||||
| N1 | de
|
||||
And table placex contains as names for N1
|
||||
| k | v
|
||||
| name | german
|
||||
| name:fi | finnish
|
||||
| name:de | german
|
||||
|
||||
Scenario: Copying default language name tag to name if it does not exist
|
||||
Given the place nodes
|
||||
| osm_id | class | type | name | geometry
|
||||
| 1 | place | locality | 'name:de' : 'german', 'name:fi' : 'finnish' | country:de
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | calculated_country_code |
|
||||
| N1 | de
|
||||
And table placex contains as names for N1
|
||||
| k | v
|
||||
| name | german
|
||||
| name:fi | finnish
|
||||
| name:de | german
|
||||
|
||||
Scenario: Do not overwrite default language with name tag
|
||||
Given the place nodes
|
||||
| osm_id | class | type | name | geometry
|
||||
| 1 | place | locality | 'name' : 'german', 'name:fi' : 'finnish', 'name:de' : 'local' | country:de
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | calculated_country_code |
|
||||
| N1 | de
|
||||
And table placex contains as names for N1
|
||||
| k | v
|
||||
| name | german
|
||||
| name:fi | finnish
|
||||
| name:de | local
|
||||
|
||||
Scenario: Landuse without name are ignored
|
||||
Given the place areas
|
||||
| osm_type | osm_id | class | type | geometry
|
||||
| R | 1 | natural | meadow | (0 0, 1 0, 1 1, 0 1, 0 0)
|
||||
| R | 2 | landuse | industrial | (0 0, -1 0, -1 -1, 0 -1, 0 0)
|
||||
When importing
|
||||
Then table placex has no entry for R1
|
||||
And table placex has no entry for R2
|
||||
|
||||
Scenario: Landuse with name are found
|
||||
Given the place areas
|
||||
| osm_type | osm_id | class | type | name | geometry
|
||||
| R | 1 | natural | meadow | 'name' : 'landuse1' | (0 0, 1 0, 1 1, 0 1, 0 0)
|
||||
| R | 2 | landuse | industrial | 'name' : 'landuse2' | (0 0, -1 0, -1 -1, 0 -1, 0 0)
|
||||
When importing
|
||||
When sending query "landuse1"
|
||||
Then results contain
|
||||
| ID | osm_type | osm_id
|
||||
| 0 | R | 1
|
||||
When sending query "landuse2"
|
||||
Then results contain
|
||||
| ID | osm_type | osm_id
|
||||
| 0 | R | 2
|
||||
|
||||
Scenario: Postcode boundaries without ref
|
||||
Given the place areas
|
||||
| osm_type | osm_id | class | type | postcode | geometry
|
||||
| R | 1 | boundary | postal_code | 12345 | (0 0, 1 0, 1 1, 0 1, 0 0)
|
||||
When importing
|
||||
When sending query "12345"
|
||||
Then results contain
|
||||
| ID | osm_type | osm_id
|
||||
| 0 | R | 1
|
||||
458
tests/features/db/import/parenting.feature
Normal file
458
tests/features/db/import/parenting.feature
Normal file
@@ -0,0 +1,458 @@
|
||||
@DB
|
||||
Feature: Parenting of objects
|
||||
Tests that the correct parent is choosen
|
||||
|
||||
Scenario: Address inherits postcode from its street unless it has a postcode
|
||||
Given the scene roads-with-pois
|
||||
And the place nodes
|
||||
| osm_id | class | type | housenumber | geometry
|
||||
| 1 | place | house | 4 | :p-N1
|
||||
And the place nodes
|
||||
| osm_id | class | type | housenumber | postcode | geometry
|
||||
| 2 | place | house | 5 | 99999 | :p-N1
|
||||
And the place ways
|
||||
| osm_id | class | type | name | postcode | geometry
|
||||
| 1 | highway | residential | galoo | 12345 | :w-north
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | parent_place_id
|
||||
| N1 | W1
|
||||
| N2 | W1
|
||||
When sending query "4 galoo"
|
||||
Then results contain
|
||||
| ID | osm_type | osm_id | langaddress
|
||||
| 0 | N | 1 | 4, galoo, 12345
|
||||
When sending query "5 galoo"
|
||||
Then results contain
|
||||
| ID | osm_type | osm_id | langaddress
|
||||
| 0 | N | 2 | 5, galoo, 99999
|
||||
|
||||
|
||||
Scenario: Address without tags, closest street
|
||||
Given the scene roads-with-pois
|
||||
And the place nodes
|
||||
| osm_id | class | type | geometry
|
||||
| 1 | place | house | :p-N1
|
||||
| 2 | place | house | :p-N2
|
||||
| 3 | place | house | :p-S1
|
||||
| 4 | place | house | :p-S2
|
||||
And the named place ways
|
||||
| osm_id | class | type | geometry
|
||||
| 1 | highway | residential | :w-north
|
||||
| 2 | highway | residential | :w-south
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | parent_place_id
|
||||
| N1 | W1
|
||||
| N2 | W1
|
||||
| N3 | W2
|
||||
| N4 | W2
|
||||
|
||||
Scenario: Address without tags avoids unnamed streets
|
||||
Given the scene roads-with-pois
|
||||
And the place nodes
|
||||
| osm_id | class | type | geometry
|
||||
| 1 | place | house | :p-N1
|
||||
| 2 | place | house | :p-N2
|
||||
| 3 | place | house | :p-S1
|
||||
| 4 | place | house | :p-S2
|
||||
And the place ways
|
||||
| osm_id | class | type | geometry
|
||||
| 1 | highway | residential | :w-north
|
||||
And the named place ways
|
||||
| osm_id | class | type | geometry
|
||||
| 2 | highway | residential | :w-south
|
||||
When importing
|
||||
Then table 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 scene roads-with-pois
|
||||
And the place nodes
|
||||
| osm_id | class | type | street| geometry
|
||||
| 1 | place | house | south | :p-N1
|
||||
| 2 | place | house | north | :p-N2
|
||||
| 3 | place | house | south | :p-S1
|
||||
| 4 | place | house | north | :p-S2
|
||||
And the place ways
|
||||
| osm_id | class | type | name | geometry
|
||||
| 1 | highway | residential | north | :w-north
|
||||
| 2 | highway | residential | south | :w-south
|
||||
When importing
|
||||
Then table 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 scene roads-with-pois
|
||||
And the place nodes
|
||||
| osm_id | class | type | street | geometry
|
||||
| 1 | place | house | abcdef | :p-N1
|
||||
| 2 | place | house | abcdef | :p-N2
|
||||
| 3 | place | house | abcdef | :p-S1
|
||||
| 4 | place | house | abcdef | :p-S2
|
||||
And the place ways
|
||||
| osm_id | class | type | name | geometry
|
||||
| 1 | highway | residential | abcdef | :w-north
|
||||
| 2 | highway | residential | abcdef | :w-south
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | parent_place_id
|
||||
| N1 | W1
|
||||
| N2 | W1
|
||||
| N3 | W2
|
||||
| N4 | W2
|
||||
|
||||
Scenario: addr:street tag without appropriately named street
|
||||
Given the scene roads-with-pois
|
||||
And the place nodes
|
||||
| osm_id | class | type | street | geometry
|
||||
| 1 | place | house | abcdef | :p-N1
|
||||
| 2 | place | house | abcdef | :p-N2
|
||||
| 3 | place | house | abcdef | :p-S1
|
||||
| 4 | place | house | abcdef | :p-S2
|
||||
And the place ways
|
||||
| osm_id | class | type | name | geometry
|
||||
| 1 | highway | residential | abcde | :w-north
|
||||
| 2 | highway | residential | abcde | :w-south
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | parent_place_id
|
||||
| N1 | W1
|
||||
| N2 | W1
|
||||
| N3 | W2
|
||||
| N4 | W2
|
||||
|
||||
Scenario: addr:place address
|
||||
Given the scene road-with-alley
|
||||
And the place nodes
|
||||
| osm_id | class | type | addr_place | geometry
|
||||
| 1 | place | house | myhamlet | :n-alley
|
||||
And the place nodes
|
||||
| osm_id | class | type | name | geometry
|
||||
| 2 | place | hamlet | myhamlet | :n-main-west
|
||||
And the place ways
|
||||
| osm_id | class | type | name | geometry
|
||||
| 1 | highway | residential | myhamlet | :w-main
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | parent_place_id
|
||||
| N1 | N2
|
||||
|
||||
Scenario: addr:street is preferred over addr:place
|
||||
Given the scene road-with-alley
|
||||
And the place nodes
|
||||
| osm_id | class | type | addr_place | street | geometry
|
||||
| 1 | place | house | myhamlet | mystreet| :n-alley
|
||||
And the place nodes
|
||||
| osm_id | class | type | name | geometry
|
||||
| 2 | place | hamlet | myhamlet | :n-main-west
|
||||
And the place ways
|
||||
| osm_id | class | type | name | geometry
|
||||
| 1 | highway | residential | mystreet | :w-main
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | parent_place_id
|
||||
| N1 | W1
|
||||
|
||||
Scenario: Untagged address in simple associated street relation
|
||||
Given the scene road-with-alley
|
||||
And the place nodes
|
||||
| osm_id | class | type | geometry
|
||||
| 1 | place | house | :n-alley
|
||||
| 2 | place | house | :n-corner
|
||||
| 3 | place | house | :n-main-west
|
||||
And the place ways
|
||||
| osm_id | class | type | name | geometry
|
||||
| 1 | highway | residential | foo | :w-main
|
||||
| 2 | highway | service | bar | :w-alley
|
||||
And the relations
|
||||
| id | members | tags
|
||||
| 1 | W1:street,N1,N2,N3 | 'type' : 'associatedStreet'
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | parent_place_id
|
||||
| N1 | W1
|
||||
| N2 | W1
|
||||
| N3 | W1
|
||||
|
||||
Scenario: Avoid unnamed streets in simple associated street relation
|
||||
Given the scene road-with-alley
|
||||
And the place nodes
|
||||
| osm_id | class | type | geometry
|
||||
| 1 | place | house | :n-alley
|
||||
| 2 | place | house | :n-corner
|
||||
| 3 | place | house | :n-main-west
|
||||
And the named place ways
|
||||
| osm_id | class | type | geometry
|
||||
| 1 | highway | residential | :w-main
|
||||
And the place ways
|
||||
| osm_id | class | type | geometry
|
||||
| 2 | highway | residential | :w-alley
|
||||
And the relations
|
||||
| id | members | tags
|
||||
| 1 | N1,N2,N3,W2:street,W1:street | 'type' : 'associatedStreet'
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | parent_place_id
|
||||
| N1 | W1
|
||||
| N2 | W1
|
||||
| N3 | W1
|
||||
|
||||
### Scenario 10
|
||||
Scenario: Associated street relation overrides addr:street
|
||||
Given the scene road-with-alley
|
||||
And the place nodes
|
||||
| osm_id | class | type | street | geometry
|
||||
| 1 | place | house | bar | :n-alley
|
||||
And the place ways
|
||||
| osm_id | class | type | name | geometry
|
||||
| 1 | highway | residential | foo | :w-main
|
||||
| 2 | highway | residential | bar | :w-alley
|
||||
And the relations
|
||||
| id | members | tags
|
||||
| 1 | W1:street,N1,N2,N3 | 'type' : 'associatedStreet'
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | parent_place_id
|
||||
| N1 | W1
|
||||
|
||||
Scenario: Building without tags, closest street from center point
|
||||
Given the scene building-on-street-corner
|
||||
And the named place ways
|
||||
| osm_id | class | type | geometry
|
||||
| 1 | building | yes | :w-building
|
||||
| 2 | highway | primary | :w-WE
|
||||
| 3 | highway | residential | :w-NS
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | parent_place_id
|
||||
| W1 | W3
|
||||
|
||||
Scenario: Building with addr:street tags
|
||||
Given the scene building-on-street-corner
|
||||
And the named place ways
|
||||
| osm_id | class | type | street | geometry
|
||||
| 1 | building | yes | bar | :w-building
|
||||
And the place ways
|
||||
| osm_id | class | type | name | geometry
|
||||
| 2 | highway | primary | bar | :w-WE
|
||||
| 3 | highway | residential | foo | :w-NS
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | parent_place_id
|
||||
| W1 | W2
|
||||
|
||||
Scenario: Building with addr:place tags
|
||||
Given the scene building-on-street-corner
|
||||
And the place nodes
|
||||
| osm_id | class | type | name | geometry
|
||||
| 1 | place | village | bar | :n-outer
|
||||
And the named place ways
|
||||
| osm_id | class | type | addr_place | geometry
|
||||
| 1 | building | yes | bar | :w-building
|
||||
And the place ways
|
||||
| osm_id | class | type | name | geometry
|
||||
| 2 | highway | primary | bar | :w-WE
|
||||
| 3 | highway | residential | foo | :w-NS
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | parent_place_id
|
||||
| W1 | N1
|
||||
|
||||
Scenario: Building in associated street relation
|
||||
Given the scene building-on-street-corner
|
||||
And the named place ways
|
||||
| osm_id | class | type | geometry
|
||||
| 1 | building | yes | :w-building
|
||||
And the place ways
|
||||
| osm_id | class | type | name | geometry
|
||||
| 2 | highway | primary | bar | :w-WE
|
||||
| 3 | highway | residential | foo | :w-NS
|
||||
And the relations
|
||||
| id | members | tags
|
||||
| 1 | W1:house,W2:street | 'type' : 'associatedStreet'
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | parent_place_id
|
||||
| W1 | W2
|
||||
|
||||
Scenario: Building in associated street relation overrides addr:street
|
||||
Given the scene building-on-street-corner
|
||||
And the named place ways
|
||||
| osm_id | class | type | street | geometry
|
||||
| 1 | building | yes | foo | :w-building
|
||||
And the place ways
|
||||
| osm_id | class | type | name | geometry
|
||||
| 2 | highway | primary | bar | :w-WE
|
||||
| 3 | highway | residential | foo | :w-NS
|
||||
And the relations
|
||||
| id | members | tags
|
||||
| 1 | W1:house,W2:street | 'type' : 'associatedStreet'
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | parent_place_id
|
||||
| W1 | W2
|
||||
|
||||
Scenario: Wrong member in associated street relation is ignored
|
||||
Given the scene building-on-street-corner
|
||||
And the named place nodes
|
||||
| osm_id | class | type | geometry
|
||||
| 1 | place | house | :n-outer
|
||||
And the named place ways
|
||||
| osm_id | class | type | street | geometry
|
||||
| 1 | building | yes | foo | :w-building
|
||||
And the place ways
|
||||
| osm_id | class | type | name | geometry
|
||||
| 2 | highway | primary | bar | :w-WE
|
||||
| 3 | highway | residential | foo | :w-NS
|
||||
And the relations
|
||||
| id | members | tags
|
||||
| 1 | N1:house,W1:street,W3:street | 'type' : 'associatedStreet'
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | parent_place_id
|
||||
| N1 | W3
|
||||
|
||||
Scenario: POIs in building inherit address
|
||||
Given the scene building-on-street-corner
|
||||
And the named place nodes
|
||||
| osm_id | class | type | geometry
|
||||
| 1 | amenity | bank | :n-inner
|
||||
| 2 | shop | bakery | :n-edge-NS
|
||||
| 3 | shop | supermarket| :n-edge-WE
|
||||
And the place ways
|
||||
| osm_id | class | type | street | addr_place | housenumber | geometry
|
||||
| 1 | building | yes | foo | nowhere | 3 | :w-building
|
||||
And the place ways
|
||||
| osm_id | class | type | name | geometry
|
||||
| 2 | highway | primary | bar | :w-WE
|
||||
| 3 | highway | residential | foo | :w-NS
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | parent_place_id | street | addr_place | housenumber
|
||||
| W1 | W3 | foo | nowhere | 3
|
||||
| N1 | W3 | foo | nowhere | 3
|
||||
| N2 | W3 | foo | nowhere | 3
|
||||
| N3 | W3 | foo | nowhere | 3
|
||||
|
||||
Scenario: POIs don't inherit from streets
|
||||
Given the scene building-on-street-corner
|
||||
And the named place nodes
|
||||
| osm_id | class | type | geometry
|
||||
| 1 | amenity | bank | :n-inner
|
||||
And the place ways
|
||||
| osm_id | class | type | street | addr_place | housenumber | geometry
|
||||
| 1 | highway | path | foo | nowhere | 3 | :w-building
|
||||
And the place ways
|
||||
| osm_id | class | type | name | geometry
|
||||
| 3 | highway | residential | foo | :w-NS
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | parent_place_id | street | addr_place | housenumber
|
||||
| N1 | W3 | None | None | None
|
||||
|
||||
Scenario: POIs with own address do not inherit building address
|
||||
Given the scene building-on-street-corner
|
||||
And the named place nodes
|
||||
| osm_id | class | type | street | geometry
|
||||
| 1 | amenity | bank | bar | :n-inner
|
||||
And the named place nodes
|
||||
| osm_id | class | type | housenumber | geometry
|
||||
| 2 | shop | bakery | 4 | :n-edge-NS
|
||||
And the named place nodes
|
||||
| osm_id | class | type | addr_place | geometry
|
||||
| 3 | shop | supermarket| nowhere | :n-edge-WE
|
||||
And the place nodes
|
||||
| osm_id | class | type | name | geometry
|
||||
| 4 | place | isolated_dwelling | theplace | :n-outer
|
||||
And the place ways
|
||||
| osm_id | class | type | addr_place | housenumber | geometry
|
||||
| 1 | building | yes | theplace | 3 | :w-building
|
||||
And the place ways
|
||||
| osm_id | class | type | name | geometry
|
||||
| 2 | highway | primary | bar | :w-WE
|
||||
| 3 | highway | residential | foo | :w-NS
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | parent_place_id | street | addr_place | housenumber
|
||||
| W1 | N4 | None | theplace | 3
|
||||
| N1 | W2 | bar | None | None
|
||||
| N2 | W3 | None | None | 4
|
||||
| N3 | W2 | None | nowhere | None
|
||||
|
||||
### Scenario 20
|
||||
Scenario: POIs parent a road if and only if they are attached to it
|
||||
Given the scene points-on-roads
|
||||
And the named place nodes
|
||||
| osm_id | class | type | street | geometry
|
||||
| 1 | highway | bus_stop | North St | :n-SE
|
||||
| 2 | highway | bus_stop | South St | :n-NW
|
||||
| 3 | highway | bus_stop | North St | :n-S-unglued
|
||||
| 4 | highway | bus_stop | South St | :n-N-unglued
|
||||
And the place ways
|
||||
| osm_id | class | type | name | geometry
|
||||
| 1 | highway | secondary | North St | :w-north
|
||||
| 2 | highway | unclassified | South St | :w-south
|
||||
And the ways
|
||||
| id | nodes
|
||||
| 1 | 100,101,2,103,104
|
||||
| 2 | 200,201,1,202,203
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | parent_place_id
|
||||
| N1 | W2
|
||||
| N2 | W1
|
||||
| N3 | W1
|
||||
| N4 | W2
|
||||
|
||||
Scenario: POIs do not parent non-roads they are attached to
|
||||
Given the scene points-on-roads
|
||||
And the named place nodes
|
||||
| osm_id | class | type | street | geometry
|
||||
| 1 | highway | bus_stop | North St | :n-SE
|
||||
| 2 | highway | bus_stop | South St | :n-NW
|
||||
And the place ways
|
||||
| osm_id | class | type | name | geometry
|
||||
| 1 | landuse | residential | North St | :w-north
|
||||
| 2 | waterway| river | South St | :w-south
|
||||
And the ways
|
||||
| id | nodes
|
||||
| 1 | 100,101,2,103,104
|
||||
| 2 | 200,201,1,202,203
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | parent_place_id
|
||||
| N1 | 0
|
||||
| N2 | 0
|
||||
|
||||
Scenario: POIs on building outlines inherit associated street relation
|
||||
Given the scene building-on-street-corner
|
||||
And the named place nodes
|
||||
| osm_id | class | type | geometry
|
||||
| 1 | place | house | :n-edge-NS
|
||||
And the named place ways
|
||||
| osm_id | class | type | geometry
|
||||
| 1 | building | yes | :w-building
|
||||
And the place ways
|
||||
| osm_id | class | type | name | geometry
|
||||
| 2 | highway | primary | bar | :w-WE
|
||||
| 3 | highway | residential | foo | :w-NS
|
||||
And the relations
|
||||
| id | members | tags
|
||||
| 1 | W1:house,W2:street | 'type' : 'associatedStreet'
|
||||
And the ways
|
||||
| id | nodes
|
||||
| 1 | 100,1,101,102,100
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | parent_place_id
|
||||
| N1 | W2
|
||||
|
||||
383
tests/features/db/import/placex.feature
Normal file
383
tests/features/db/import/placex.feature
Normal file
@@ -0,0 +1,383 @@
|
||||
@DB
|
||||
Feature: Import into placex
|
||||
Tests that data in placex is completed correctly.
|
||||
|
||||
Scenario: No country code tag is available
|
||||
Given the place nodes
|
||||
| osm_id | class | type | name | geometry
|
||||
| 1 | highway | primary | 'name' : 'A1' | country:us
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | country_code | calculated_country_code |
|
||||
| N1 | None | us |
|
||||
|
||||
Scenario: Location overwrites country code tag
|
||||
Given the scene country
|
||||
And the place nodes
|
||||
| osm_id | class | type | name | country_code | geometry
|
||||
| 1 | highway | primary | 'name' : 'A1' | de | :us
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | country_code | calculated_country_code |
|
||||
| N1 | de | us |
|
||||
|
||||
Scenario: Country code tag overwrites location for countries
|
||||
Given the place areas
|
||||
| osm_type | osm_id | class | type | admin_level | name | country_code | geometry
|
||||
| R | 1 | boundary | administrative | 2 | 'name' : 'foo' | de | (-100 40, -101 40, -101 41, -100 41, -100 40)
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | country_code | calculated_country_code |
|
||||
| R1 | de | de |
|
||||
|
||||
Scenario: Illegal country code tag for countries is ignored
|
||||
And the place areas
|
||||
| osm_type | osm_id | class | type | admin_level | name | country_code | geometry
|
||||
| R | 1 | boundary | administrative | 2 | 'name' : 'foo' | xx | (-100 40, -101 40, -101 41, -100 41, -100 40)
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | country_code | calculated_country_code |
|
||||
| R1 | xx | us |
|
||||
|
||||
Scenario: admin level is copied over
|
||||
Given the place nodes
|
||||
| osm_id | class | type | admin_level | name
|
||||
| 1 | place | state | 3 | 'name' : 'foo'
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | admin_level |
|
||||
| N1 | 3 |
|
||||
|
||||
Scenario: admin level is default 15
|
||||
Given the place nodes
|
||||
| osm_id | class | type | name
|
||||
| 1 | amenity | prison | 'name' : 'foo'
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | admin_level |
|
||||
| N1 | 15 |
|
||||
|
||||
Scenario: admin level is never larger than 15
|
||||
Given the place nodes
|
||||
| osm_id | class | type | name | admin_level
|
||||
| 1 | amenity | prison | 'name' : 'foo' | 16
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | admin_level |
|
||||
| N1 | 15 |
|
||||
|
||||
|
||||
Scenario: postcode node without postcode is dropped
|
||||
Given the place nodes
|
||||
| osm_id | class | type
|
||||
| 1 | place | postcode
|
||||
When importing
|
||||
Then table placex has no entry for N1
|
||||
|
||||
Scenario: postcode boundary without postcode is dropped
|
||||
Given the place areas
|
||||
| osm_type | osm_id | class | type | geometry
|
||||
| R | 1 | boundary | postal_code | poly-area:0.1
|
||||
When importing
|
||||
Then table placex has no entry for R1
|
||||
|
||||
Scenario: search and address ranks for GB post codes correctly assigned
|
||||
Given the place nodes
|
||||
| osm_id | class | type | postcode | geometry
|
||||
| 1 | place | postcode | E45 2CD | country:gb
|
||||
| 2 | place | postcode | E45 2 | country:gb
|
||||
| 3 | place | postcode | Y45 | country:gb
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | postcode | calculated_country_code | rank_search | rank_address
|
||||
| N1 | E45 2CD | gb | 25 | 5
|
||||
| N2 | E45 2 | gb | 23 | 5
|
||||
| N3 | Y45 | gb | 21 | 5
|
||||
|
||||
Scenario: wrongly formatted GB postcodes are down-ranked
|
||||
Given the place nodes
|
||||
| osm_id | class | type | postcode | geometry
|
||||
| 1 | place | postcode | EA452CD | country:gb
|
||||
| 2 | place | postcode | E45 23 | country:gb
|
||||
| 3 | place | postcode | y45 | country:gb
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | calculated_country_code | rank_search | rank_address
|
||||
| N1 | gb | 30 | 30
|
||||
| N2 | gb | 30 | 30
|
||||
| N3 | gb | 30 | 30
|
||||
|
||||
Scenario: search and address rank for DE postcodes correctly assigned
|
||||
Given the place nodes
|
||||
| osm_id | class | type | postcode | geometry
|
||||
| 1 | place | postcode | 56427 | country:de
|
||||
| 2 | place | postcode | 5642 | country:de
|
||||
| 3 | place | postcode | 5642A | country:de
|
||||
| 4 | place | postcode | 564276 | country:de
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | calculated_country_code | rank_search | rank_address
|
||||
| N1 | de | 21 | 11
|
||||
| N2 | de | 30 | 30
|
||||
| N3 | de | 30 | 30
|
||||
| N4 | de | 30 | 30
|
||||
|
||||
Scenario: search and address rank for other postcodes are correctly assigned
|
||||
Given the place nodes
|
||||
| osm_id | class | type | postcode | geometry
|
||||
| 1 | place | postcode | 1 | country:ca
|
||||
| 2 | place | postcode | X3 | country:ca
|
||||
| 3 | place | postcode | 543 | country:ca
|
||||
| 4 | place | postcode | 54dc | country:ca
|
||||
| 5 | place | postcode | 12345 | country:ca
|
||||
| 6 | place | postcode | 55TT667 | country:ca
|
||||
| 7 | place | postcode | 123-65 | country:ca
|
||||
| 8 | place | postcode | 12 445 4 | country:ca
|
||||
| 9 | place | postcode | A1:bc10 | country:ca
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | calculated_country_code | rank_search | rank_address
|
||||
| N1 | ca | 21 | 11
|
||||
| N2 | ca | 21 | 11
|
||||
| N3 | ca | 21 | 11
|
||||
| N4 | ca | 21 | 11
|
||||
| N5 | ca | 21 | 11
|
||||
| N6 | ca | 21 | 11
|
||||
| N7 | ca | 25 | 11
|
||||
| N8 | ca | 25 | 11
|
||||
| N9 | ca | 25 | 11
|
||||
|
||||
|
||||
Scenario: search and address ranks for places are correctly assigned
|
||||
Given the named place nodes
|
||||
| osm_id | class | type |
|
||||
| 1 | foo | bar |
|
||||
| 11 | place | Continent |
|
||||
| 12 | place | continent |
|
||||
| 13 | place | sea |
|
||||
| 14 | place | country |
|
||||
| 15 | place | state |
|
||||
| 16 | place | region |
|
||||
| 17 | place | county |
|
||||
| 18 | place | city |
|
||||
| 19 | place | island |
|
||||
| 20 | place | town |
|
||||
| 21 | place | village |
|
||||
| 22 | place | hamlet |
|
||||
| 23 | place | municipality |
|
||||
| 24 | place | district |
|
||||
| 25 | place | unincorporated_area |
|
||||
| 26 | place | borough |
|
||||
| 27 | place | suburb |
|
||||
| 28 | place | croft |
|
||||
| 29 | place | subdivision |
|
||||
| 30 | place | isolated_dwelling |
|
||||
| 31 | place | farm |
|
||||
| 32 | place | locality |
|
||||
| 33 | place | islet |
|
||||
| 34 | place | mountain_pass |
|
||||
| 35 | place | neighbourhood |
|
||||
| 36 | place | house |
|
||||
| 37 | place | building |
|
||||
| 38 | place | houses |
|
||||
And the named place nodes
|
||||
| osm_id | class | type | extratags
|
||||
| 100 | place | locality | 'locality' : 'townland'
|
||||
| 101 | place | city | 'capital' : 'yes'
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | rank_search | rank_address |
|
||||
| N1 | 30 | 30 |
|
||||
| N11 | 30 | 30 |
|
||||
| N12 | 2 | 2 |
|
||||
| N13 | 2 | 0 |
|
||||
| N14 | 4 | 4 |
|
||||
| N15 | 8 | 8 |
|
||||
| N16 | 18 | 0 |
|
||||
| N17 | 12 | 12 |
|
||||
| N18 | 16 | 16 |
|
||||
| N19 | 17 | 0 |
|
||||
| N20 | 18 | 16 |
|
||||
| N21 | 19 | 16 |
|
||||
| N22 | 19 | 16 |
|
||||
| N23 | 19 | 16 |
|
||||
| N24 | 19 | 16 |
|
||||
| N25 | 19 | 16 |
|
||||
| N26 | 19 | 16 |
|
||||
| N27 | 20 | 20 |
|
||||
| N28 | 20 | 20 |
|
||||
| N29 | 20 | 20 |
|
||||
| N30 | 20 | 20 |
|
||||
| N31 | 20 | 0 |
|
||||
| N32 | 20 | 0 |
|
||||
| N33 | 20 | 0 |
|
||||
| N34 | 20 | 0 |
|
||||
| N100 | 20 | 20 |
|
||||
| N101 | 15 | 16 |
|
||||
| N35 | 22 | 22 |
|
||||
| N36 | 30 | 30 |
|
||||
| N37 | 30 | 30 |
|
||||
| N38 | 28 | 0 |
|
||||
|
||||
Scenario: search and address ranks for boundaries are correctly assigned
|
||||
Given the named place nodes
|
||||
| osm_id | class | type
|
||||
| 1 | boundary | administrative
|
||||
And the named place ways
|
||||
| osm_id | class | type | geometry
|
||||
| 10 | boundary | administrative | 10 10, 11 11
|
||||
And the named place areas
|
||||
| osm_type | osm_id | class | type | admin_level | geometry
|
||||
| R | 20 | boundary | administrative | 2 | (1 1, 2 2, 1 2, 1 1)
|
||||
| R | 21 | boundary | administrative | 32 | (3 3, 4 4, 3 4, 3 3)
|
||||
| R | 22 | boundary | nature_park | 6 | (0 0, 1 0, 0 1, 0 0)
|
||||
| R | 23 | boundary | natural_reserve| 10 | (0 0, 1 1, 1 0, 0 0)
|
||||
When importing
|
||||
Then table placex has no entry for N1
|
||||
And table placex has no entry for W10
|
||||
And table placex contains
|
||||
| object | rank_search | rank_address
|
||||
| R20 | 4 | 4
|
||||
| R21 | 30 | 30
|
||||
| R22 | 12 | 0
|
||||
| R23 | 20 | 0
|
||||
|
||||
Scenario Outline: minor highways droped without name, included with
|
||||
Given the scene roads-with-pois
|
||||
And a wiped database
|
||||
And the place ways
|
||||
| osm_id | class | type | geometry
|
||||
| 1 | highway | <type> | :w-south
|
||||
And the named place ways
|
||||
| osm_id | class | type | geometry
|
||||
| 2 | highway | <type> | :w-north
|
||||
When importing
|
||||
Then table placex has no entry for W1
|
||||
And table placex contains
|
||||
| object | rank_search | rank_address
|
||||
| W2 | <rank> | <rank>
|
||||
|
||||
Examples:
|
||||
| type | rank
|
||||
| service | 27
|
||||
| cycleway | 27
|
||||
| path | 27
|
||||
| footway | 27
|
||||
| steps | 27
|
||||
| bridleway | 27
|
||||
| track | 26
|
||||
| byway | 26
|
||||
| motorway_link | 27
|
||||
| primary_link | 27
|
||||
| trunk_link | 27
|
||||
| secondary_link| 27
|
||||
| tertiary_link | 27
|
||||
|
||||
Scenario: search and address ranks for highways correctly assigned
|
||||
Given the scene roads-with-pois
|
||||
And the place nodes
|
||||
| osm_id | class | type
|
||||
| 1 | highway | bus_stop
|
||||
And the place ways
|
||||
| osm_id | class | type | geometry
|
||||
| 1 | highway | primary | :w-south
|
||||
| 2 | highway | secondary | :w-south
|
||||
| 3 | highway | tertiary | :w-south
|
||||
| 4 | highway | residential | :w-north
|
||||
| 5 | highway | unclassified | :w-north
|
||||
| 6 | highway | something | :w-north
|
||||
When importing
|
||||
Then table 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 | 26 | 26
|
||||
|
||||
Scenario: rank and inclusion of landuses
|
||||
Given the place nodes
|
||||
| osm_id | class | type
|
||||
| 1 | landuse | residential
|
||||
And the named place nodes
|
||||
| osm_id | class | type
|
||||
| 2 | landuse | residential
|
||||
And the place ways
|
||||
| osm_id | class | type | geometry
|
||||
| 1 | landuse | residential | 0 0, 0 1
|
||||
And the named place ways
|
||||
| osm_id | class | type | geometry
|
||||
| 2 | landuse | residential | 1 1, 1 1.1
|
||||
And the place areas
|
||||
| osm_type | osm_id | class | type | geometry
|
||||
| W | 3 | landuse | residential | poly-area:0.1
|
||||
| R | 1 | landuse | residential | poly-area:0.01
|
||||
| R | 10 | landuse | residential | poly-area:0.5
|
||||
And the named place areas
|
||||
| osm_type | osm_id | class | type | geometry
|
||||
| W | 4 | landuse | residential | poly-area:0.1
|
||||
| R | 2 | landuse | residential | poly-area:0.05
|
||||
When importing
|
||||
Then table placex has no entry for N1
|
||||
And table placex has no entry for W1
|
||||
And table placex has no entry for W3
|
||||
And table placex has no entry for R1
|
||||
And table placex has no entry for R10
|
||||
And table placex contains
|
||||
| object | rank_search | rank_address
|
||||
| N2 | 30 | 30
|
||||
| W2 | 30 | 30
|
||||
| W4 | 22 | 22
|
||||
| R2 | 22 | 22
|
||||
|
||||
Scenario: rank and inclusion of naturals
|
||||
Given the place nodes
|
||||
| osm_id | class | type
|
||||
| 1 | natural | peak
|
||||
| 3 | natural | volcano
|
||||
And the named place nodes
|
||||
| osm_id | class | type
|
||||
| 2 | natural | peak
|
||||
| 4 | natural | volcano
|
||||
| 5 | natural | foobar
|
||||
And the place ways
|
||||
| osm_id | class | type | geometry
|
||||
| 1 | natural | mountain_range | 10 10,11 11
|
||||
And the named place ways
|
||||
| osm_id | class | type | geometry
|
||||
| 2 | natural | mountain_range | 12 12,11 11
|
||||
| 3 | natural | foobar | 13 13,13.1 13
|
||||
| 4 | natural | coastline | 14 14,14.1 14
|
||||
And the place areas
|
||||
| osm_type | osm_id | class | type | geometry
|
||||
| R | 1 | natural | volcano | poly-area:0.1
|
||||
| R | 2 | natural | volcano | poly-area:1.0
|
||||
And the named place areas
|
||||
| osm_type | osm_id | class | type | geometry
|
||||
| R | 3 | natural | volcano | poly-area:0.1
|
||||
| R | 4 | natural | foobar | poly-area:0.5
|
||||
| R | 5 | natural | sea | poly-area:5.0
|
||||
| R | 6 | natural | sea | poly-area:0.01
|
||||
| R | 7 | natural | coastline | poly-area:1.0
|
||||
When importing
|
||||
Then table placex has no entry for N1
|
||||
And table placex has no entry for N3
|
||||
And table placex has no entry for W1
|
||||
And table placex has no entry for R1
|
||||
And table placex has no entry for R2
|
||||
And table placex has no entry for R7
|
||||
And table placex has no entry for W4
|
||||
And table placex contains
|
||||
| object | rank_search | rank_address
|
||||
| N2 | 18 | 0
|
||||
| N4 | 18 | 0
|
||||
| N5 | 30 | 30
|
||||
| W2 | 18 | 0
|
||||
| R3 | 18 | 0
|
||||
| R4 | 22 | 22
|
||||
| R5 | 4 | 4
|
||||
| R6 | 4 | 4
|
||||
| W3 | 30 | 30
|
||||
|
||||
28
tests/features/db/import/search_terms.feature
Normal file
28
tests/features/db/import/search_terms.feature
Normal file
@@ -0,0 +1,28 @@
|
||||
@DB
|
||||
Feature: Creation of search terms
|
||||
Tests that search_name table is filled correctly
|
||||
|
||||
Scenario: POIs without a name have no search entry
|
||||
Given the scene roads-with-pois
|
||||
And the place nodes
|
||||
| osm_id | class | type | geometry
|
||||
| 1 | place | house | :p-N1
|
||||
And the place ways
|
||||
| osm_id | class | type | geometry
|
||||
| 1 | highway | residential | :w-north
|
||||
When importing
|
||||
Then table search_name has no entry for N1
|
||||
|
||||
|
||||
Scenario: Named POIs inherit address from parent
|
||||
Given the scene roads-with-pois
|
||||
And the place nodes
|
||||
| osm_id | class | type | name | geometry
|
||||
| 1 | place | house | foo | :p-N1
|
||||
And the place ways
|
||||
| osm_id | class | type | name | geometry
|
||||
| 1 | highway | residential | the road | :w-north
|
||||
When importing
|
||||
Then search_name table contains
|
||||
| place_id | name_vector | nameaddress_vector
|
||||
| N1 | foo | the road
|
||||
17
tests/features/db/import/simple.feature
Normal file
17
tests/features/db/import/simple.feature
Normal file
@@ -0,0 +1,17 @@
|
||||
@DB
|
||||
Feature: Import of simple objects
|
||||
Testing simple stuff
|
||||
|
||||
Scenario: Import place node
|
||||
Given the place nodes:
|
||||
| osm_id | class | type | name | geometry
|
||||
| 1 | place | village | 'name' : 'Foo' | 10.0 -10.0
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | class | type | name | centroid
|
||||
| N1 | place | village | 'name' : 'Foo' | 10.0,-10.0 +- 1m
|
||||
When sending query "Foo"
|
||||
Then results contain
|
||||
| ID | osm_type | osm_id
|
||||
| 0 | N | 1
|
||||
|
||||
92
tests/features/db/update/linked_places.feature
Normal file
92
tests/features/db/update/linked_places.feature
Normal file
@@ -0,0 +1,92 @@
|
||||
@DB
|
||||
Feature: Updates of linked places
|
||||
Tests that linked places are correctly added and deleted.
|
||||
|
||||
|
||||
Scenario: Add linked place when linking relation is renamed
|
||||
Given the place nodes
|
||||
| osm_id | class | type | name | geometry
|
||||
| 1 | place | city | foo | 0 0
|
||||
And the place areas
|
||||
| osm_type | osm_id | class | type | name | admin_level | geometry
|
||||
| R | 1 | boundary | administrative | foo | 8 | poly-area:0.1
|
||||
When importing
|
||||
And sending query "foo" with dups
|
||||
Then results contain
|
||||
| osm_type
|
||||
| R
|
||||
When updating place areas
|
||||
| osm_type | osm_id | class | type | name | admin_level | geometry
|
||||
| R | 1 | boundary | administrative | foobar | 8 | poly-area:0.1
|
||||
Then table placex contains
|
||||
| object | linked_place_id
|
||||
| N1 | None
|
||||
When sending query "foo" with dups
|
||||
Then results contain
|
||||
| osm_type
|
||||
| N
|
||||
|
||||
Scenario: Add linked place when linking relation is removed
|
||||
Given the place nodes
|
||||
| osm_id | class | type | name | geometry
|
||||
| 1 | place | city | foo | 0 0
|
||||
And the place areas
|
||||
| osm_type | osm_id | class | type | name | admin_level | geometry
|
||||
| R | 1 | boundary | administrative | foo | 8 | poly-area:0.1
|
||||
When importing
|
||||
And sending query "foo" with dups
|
||||
Then results contain
|
||||
| osm_type
|
||||
| R
|
||||
When marking for delete R1
|
||||
Then table placex contains
|
||||
| object | linked_place_id
|
||||
| N1 | None
|
||||
And sending query "foo" with dups
|
||||
Then results contain
|
||||
| osm_type
|
||||
| N
|
||||
|
||||
Scenario: Remove linked place when linking relation is added
|
||||
Given the place nodes
|
||||
| osm_id | class | type | name | geometry
|
||||
| 1 | place | city | foo | 0 0
|
||||
When importing
|
||||
And sending query "foo" with dups
|
||||
Then results contain
|
||||
| osm_type
|
||||
| N
|
||||
When updating place areas
|
||||
| osm_type | osm_id | class | type | name | admin_level | geometry
|
||||
| R | 1 | boundary | administrative | foo | 8 | poly-area:0.1
|
||||
Then table placex contains
|
||||
| object | linked_place_id
|
||||
| N1 | R1
|
||||
When sending query "foo" with dups
|
||||
Then results contain
|
||||
| osm_type
|
||||
| R
|
||||
|
||||
Scenario: Remove linked place when linking relation is renamed
|
||||
Given the place nodes
|
||||
| osm_id | class | type | name | geometry
|
||||
| 1 | place | city | foo | 0 0
|
||||
And the place areas
|
||||
| osm_type | osm_id | class | type | name | admin_level | geometry
|
||||
| R | 1 | boundary | administrative | foobar | 8 | poly-area:0.1
|
||||
When importing
|
||||
And sending query "foo" with dups
|
||||
Then results contain
|
||||
| osm_type
|
||||
| N
|
||||
When updating place areas
|
||||
| osm_type | osm_id | class | type | name | admin_level | geometry
|
||||
| R | 1 | boundary | administrative | foo | 8 | poly-area:0.1
|
||||
Then table placex contains
|
||||
| object | linked_place_id
|
||||
| N1 | R1
|
||||
When sending query "foo" with dups
|
||||
Then results contain
|
||||
| osm_type
|
||||
| R
|
||||
|
||||
39
tests/features/db/update/naming.feature
Normal file
39
tests/features/db/update/naming.feature
Normal file
@@ -0,0 +1,39 @@
|
||||
@DB
|
||||
Feature: Update of names in place objects
|
||||
Test all naming related issues in updates
|
||||
|
||||
|
||||
Scenario: Updating postcode in postcode boundaries without ref
|
||||
Given the place areas
|
||||
| osm_type | osm_id | class | type | postcode | geometry
|
||||
| R | 1 | boundary | postal_code | 12345 | (0 0, 1 0, 1 1, 0 1, 0 0)
|
||||
When importing
|
||||
And sending query "12345"
|
||||
Then results contain
|
||||
| ID | osm_type | osm_id
|
||||
| 0 | R | 1
|
||||
When updating place areas
|
||||
| osm_type | osm_id | class | type | postcode | geometry
|
||||
| R | 1 | boundary | postal_code | 54321 | (0 0, 1 0, 1 1, 0 1, 0 0)
|
||||
And sending query "12345"
|
||||
Then exactly 0 results are returned
|
||||
When sending query "54321"
|
||||
Then results contain
|
||||
| ID | osm_type | osm_id
|
||||
| 0 | R | 1
|
||||
|
||||
|
||||
Scenario: Delete postcode from postcode boundaries without ref
|
||||
Given the place areas
|
||||
| osm_type | osm_id | class | type | postcode | geometry
|
||||
| R | 1 | boundary | postal_code | 12345 | (0 0, 1 0, 1 1, 0 1, 0 0)
|
||||
When importing
|
||||
And sending query "12345"
|
||||
Then results contain
|
||||
| ID | osm_type | osm_id
|
||||
| 0 | R | 1
|
||||
When updating place areas
|
||||
| osm_type | osm_id | class | type | geometry
|
||||
| R | 1 | boundary | postal_code | (0 0, 1 0, 1 1, 0 1, 0 0)
|
||||
Then table placex has no entry for R1
|
||||
|
||||
55
tests/features/db/update/simple.feature
Normal file
55
tests/features/db/update/simple.feature
Normal file
@@ -0,0 +1,55 @@
|
||||
@DB
|
||||
Feature: Update of simple objects
|
||||
Testing simple stuff
|
||||
|
||||
Scenario: Remove name from a landuse object
|
||||
Given the place nodes
|
||||
| osm_id | class | type | name
|
||||
| 1 | landuse | wood | 'name' : 'Foo'
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | class | type | name
|
||||
| N1 | landuse| wood | 'name' : 'Foo'
|
||||
When updating place nodes
|
||||
| osm_id | class | type
|
||||
| 1 | landuse | wood
|
||||
Then table placex has no entry for N1
|
||||
|
||||
|
||||
Scenario: Do delete small boundary features
|
||||
Given the place areas
|
||||
| osm_type | osm_id | class | type | admin_level | geometry
|
||||
| R | 1 | boundary | administrative | 3 | (0 0, 1 0, 1 1, 0 1, 0 0)
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | rank_search
|
||||
| R1 | 6
|
||||
When marking for delete R1
|
||||
Then table placex has no entry for R1
|
||||
|
||||
Scenario: Do not delete large boundary features
|
||||
Given the place areas
|
||||
| osm_type | osm_id | class | type | admin_level | geometry
|
||||
| R | 1 | boundary | administrative | 3 | (0 0, 2 0, 2 2.1, 0 2, 0 0)
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | rank_search
|
||||
| R1 | 6
|
||||
When marking for delete R1
|
||||
Then table placex contains
|
||||
| object | rank_search
|
||||
| R1 | 6
|
||||
|
||||
Scenario: Do delete large features of low rank
|
||||
Given the named place areas
|
||||
| osm_type | osm_id | class | type | geometry
|
||||
| W | 1 | place | house | (0 0, 2 0, 2 2.1, 0 2, 0 0)
|
||||
| R | 1 | boundary | national_park | (0 0, 2 0, 2 2.1, 0 2, 0 0)
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | rank_address
|
||||
| R1 | 0
|
||||
| W1 | 30
|
||||
When marking for delete R1,W1
|
||||
Then table placex has no entry for W1
|
||||
Then table placex has no entry for R1
|
||||
Reference in New Issue
Block a user