add functional tests

These are the tests that were formerly located at
https://github.com/lonvia/test-nominatim
This commit is contained in:
Sarah Hoffmann
2014-09-07 17:02:10 +02:00
parent e7ee9c2d84
commit 86d90bc460
43 changed files with 4601 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
Feature: Object details
Check details page for correctness
Scenario Outline: Details via OSM id
When looking up details for <object>
Then the result is valid
Examples:
| object
| 1758375
| N158845944
| W72493656
| R62422

View File

@@ -0,0 +1,100 @@
Feature: Localization of search results
Scenario: Search - default language
When sending json search query "Germany"
Then results contain
| ID | display_name
| 0 | Deutschland.*
Scenario: Search - accept-language first
Given the request parameters
| accept-language
| en,de
When sending json search query "Deutschland"
Then results contain
| ID | display_name
| 0 | Germany.*
Scenario: Search - accept-language missing
Given the request parameters
| accept-language
| xx,fr,en,de
When sending json search query "Deutschland"
Then results contain
| ID | display_name
| 0 | Allemagne.*
Scenario: Search - http accept language header first
Given the HTTP header
| accept-language
| fr-ca,fr;q=0.8,en-ca;q=0.5,en;q=0.3
When sending json search query "Deutschland"
Then results contain
| ID | display_name
| 0 | Allemagne.*
Scenario: Search - http accept language header and accept-language
Given the request parameters
| accept-language
| de,en
Given the HTTP header
| accept-language
| fr-ca,fr;q=0.8,en-ca;q=0.5,en;q=0.3
When sending json search query "Deutschland"
Then results contain
| ID | display_name
| 0 | Deutschland.*
Scenario: Search - http accept language header fallback
Given the HTTP header
| accept-language
| fr-ca,en-ca;q=0.5
When sending json search query "Deutschland"
Then results contain
| ID | display_name
| 0 | Allemagne.*
Scenario: Search - http accept language header fallback (upper case)
Given the HTTP header
| accept-language
| fr-FR;q=0.8,en-ca;q=0.5
When sending json search query "Deutschland"
Then results contain
| ID | display_name
| 0 | Allemagne.*
Scenario: Reverse - default language
When looking up coordinates 48.13921,11.57328
Then result addresses contain
| ID | city
| 0 | München
Scenario: Reverse - accept-language parameter
Given the request parameters
| accept-language
| en,fr
When looking up coordinates 48.13921,11.57328
Then result addresses contain
| ID | city
| 0 | Munich
Scenario: Reverse - HTTP accept language header
Given the HTTP header
| accept-language
| fr-ca,fr;q=0.8,en-ca;q=0.5,en;q=0.3
When looking up coordinates 48.13921,11.57328
Then result addresses contain
| ID | city
| 0 | Munich
Scenario: Reverse - accept-language parameter and HTTP header
Given the request parameters
| accept-language
| it
Given the HTTP header
| accept-language
| fr-ca,fr;q=0.8,en-ca;q=0.5,en;q=0.3
When looking up coordinates 48.13921,11.57328
Then result addresses contain
| ID | city
| 0 | Monaco di Baviera

View File

@@ -0,0 +1,179 @@
Feature: API regression tests
Tests error cases reported in tickets.
@poldi-only
Scenario Outline: github #36
When sending json search query "<query>" with address
Then result addresses contain
| ID | road | city
| 0 | Seegasse | Gemeinde Wieselburg-Land
Examples:
| query
| Seegasse, Gemeinde Wieselburg-Land
| Seegasse, Wieselburg-Land
| Seegasse, Wieselburg
Scenario: trac #2430
When sending json search query "89 River Avenue, Hoddesdon, Hertfordshire, EN11 0JT"
Then at least 1 result is returned
Scenario: trac #2440
When sending json search query "East Harvard Avenue, Denver"
Then more than 2 results are returned
Scenario: trac #2456
When sending xml search query "Borlänge Kommun"
Then results contain
| ID | place_rank
| 0 | 19
Scenario: trac #2530
When sending json search query "Lange Straße, Bamberg" with address
Then result addresses contain
| ID | town
| 0 | Bamberg
Scenario: trac #2541
When sending json search query "pad, germany"
Then results contain
| ID | class | display_name
| 0 | aeroway | Paderborn/Lippstadt,.*
Scenario: trac #2579
When sending json search query "Johnsons Close, hackbridge" with address
Then result addresses contain
| ID | postcode
| 0 | SM5 2LU
@Fail
Scenario Outline: trac #2586
When sending json search query "<query>" with address
Then result addresses contain
| ID | country_code
| 0 | uk
Examples:
| query
| DL7 0SN
| DL70SN
Scenario: trac #2628 (1)
When sending json search query "Adam Kraft Str" with address
Then result addresses contain
| ID | road
| 0 | Adam-Kraft-Straße
Scenario: trac #2628 (2)
When sending json search query "Maxfeldstr. 5, Nürnberg" with address
Then result addresses contain
| ID | house_number | road | city
| 0 | 5 | Maxfeldstraße | Nürnberg
Scenario: trac #2638
When sending json search query "Nöthnitzer Str. 40, 01187 Dresden" with address
Then result addresses contain
| ID | house_number | road | city
| 0 | 40 | Nöthnitzer Straße | Dresden
Scenario Outline: trac #2667
When sending json search query "<query>" with address
Then result addresses contain
| ID | house_number
| 0 | <number>
Examples:
| number | query
| 16 | 16 Woodpecker Way, Cambourne
| 14906 | 14906, 114 Street Northwest, Edmonton, Alberta, Canada
| 14904 | 14904, 114 Street Northwest, Edmonton, Alberta, Canada
| 15022 | 15022, 114 Street Northwest, Edmonton, Alberta, Canada
| 15024 | 15024, 114 Street Northwest, Edmonton, Alberta, Canada
Scenario: trac #2681
When sending json search query "kirchstraße troisdorf Germany"
Then results contain
| ID | display_name
| 0 | .*, Troisdorf, .*
Scenario: trac #2758
When sending json search query "6а, полуботка, чернигов" with address
Then result addresses contain
| ID | house_number
| 0 | 6а
Scenario: trac #2790
When looking up coordinates 49.0942079697809,8.27565898861822
Then result addresses contain
| ID | road | village | country
| 0 | Daimlerstraße | Jockgrim | Deutschland
Scenario: trac #2794
When sending json search query "4008"
Then results contain
| ID | class | type
| 0 | place | postcode
Scenario: trac #2797
When sending json search query "Philippstr.4, 52349 Düren" with address
Then result addresses contain
| ID | road | town
| 0 | Philippstraße | Düren
Scenario: trac #2830
When sending json search query "528, Merkley Drive, K4A 1N5,CA" with address
Then result addresses contain
| ID | house_number | road | postcode | country
| 0 | 528 | Merkley Drive | K4A 1N5 | Canada
Scenario: trac #2830
When sending json search query "K4A 1N5,CA"
Then results contain
| ID | class | type | display_name
| 0 | place | postcode | .*, Canada
Scenario: trac #2845
When sending json search query "Leliestraat 31, Zwolle" with address
Then result addresses contain
| ID | city
| 0 | Zwolle
Scenario: trac #2852
When sending json search query "berlinerstrasse, leipzig" with address
Then result addresses contain
| ID | road
| 0 | Berliner Straße
Scenario: trac #2871
When looking up coordinates -33.906895553,150.99609375
Then result addresses contain
| ID | city | postcode | country
| 0 | [^0-9]* | 2197 | Australia
Scenario: trac #2974
When sending json search query "Azadi Square, Faruj" with address
Then result addresses contain
| ID | road | city
| 0 | ميدان آزادي | فاروج
And results contain
| ID | latlon
| 0 | 37.2323,58.2193 +-1km
Scenario: trac #2981
When sending json search query "Ohmstraße 7, Berlin" with address
Then at least 2 results are returned
And result addresses contain
| house_number | road | state
| 7 | Ohmstraße | Berlin
Scenario: trac #3049
When sending json search query "Soccer City"
Then results contain
| ID | class | type | latlon
| 0 | leisure | stadium | -26.2347261,27.982645 +-50m
Scenario: trac #3130
When sending json search query "Old Way, Frinton"
Then results contain
| ID | class | latlon
| 0 | highway | 51.8324206,1.2447352 +-100m

View File

@@ -0,0 +1,13 @@
Feature: Reverse geocoding
Testing the reverse function
# Make sure country is not overwritten by the postcode
Scenario: Country is returned
Given the request parameters
| accept-language
| de
When looking up coordinates 53.9788769,13.0830313
Then result addresses contain
| ID | country
| 0 | Deutschland

View File

@@ -0,0 +1,52 @@
Feature: Simple Reverse Tests
Simple tests for internal server errors and response format.
These tests should pass on any Nominatim installation.
Scenario Outline: Simple reverse-geocoding
When looking up xml coordinates <lat>,<lon>
Then the result is valid xml
When looking up json coordinates <lat>,<lon>
Then the result is valid json
When looking up jsonv2 coordinates <lat>,<lon>
Then the result is valid json
Examples:
| lat | lon
| 0.0 | 0.0
| 45.3 | 3.5
| -79.34 | 23.5
| 0.23 | -178.555
Scenario Outline: Wrapping of legal jsonp requests
Given the request parameters
| json_callback
| foo
When looking up <format> coordinates 67.3245,0.456
Then the result is valid json
Examples:
| format
| json
| jsonv2
Scenario: Reverse-geocoding without address
Given the request parameters
| addressdetails
| 0
When looking up xml coordinates 36.791966,127.171726
Then the result is valid xml
When looking up json coordinates 36.791966,127.171726
Then the result is valid json
When looking up jsonv2 coordinates 36.791966,127.171726
Then the result is valid json
Scenario: Reverse-geocoding with zoom
Given the request parameters
| zoom
| 10
When looking up xml coordinates 36.791966,127.171726
Then the result is valid xml
When looking up json coordinates 36.791966,127.171726
Then the result is valid json
When looking up jsonv2 coordinates 36.791966,127.171726
Then the result is valid json

View File

@@ -0,0 +1,74 @@
Feature: Search queries
Testing correctness of results
Scenario: UK House number search
When sending json search query "27 Thoresby Road, Broxtowe" with address
Then address of result 0 contains
| type | value
| house_number | 27
| road | Thoresby Road
| city | Broxtowe
| state | England
| country | United Kingdom
| country_code | gb
Scenario: House number search for non-street address
Given the request parameters
| accept-language
| en
When sending json search query "4 Pomocnia, Poland" with address
Then address of result 0 is
| type | value
| house_number | 4
| suburb | Pomocnia
| county | gmina Pokrzywnica
| state | Masovian Voivodeship
| postcode | 06-121
| country | Poland
| country_code | pl
Scenario: House number interpolation even
Given the request parameters
| accept-language
| en
When sending json search query "140 rue Don Bosco, Saguenay" with address
Then address of result 0 contains
| type | value
| house_number | 140
| road | rue Don Bosco
| city | Saguenay
| state | Quebec
| country | Canada
| country_code | ca
Scenario: House number interpolation odd
Given the request parameters
| accept-language
| en
When sending json search query "141 rue Don Bosco, Saguenay" with address
Then address of result 0 contains
| type | value
| house_number | 141
| road | rue Don Bosco
| city | Saguenay
| state | Quebec
| country | Canada
| country_code | ca
Scenario: TIGER house number
When sending json search query "3 West Victory Way, Craig"
Then result 0 has not attributes osm_id,osm_type
Scenario: TIGER house number (road fallback)
When sending json search query "3030 West Victory Way, Craig"
Then result 0 has attributes osm_id,osm_type
Scenario: Expansion of Illinois
Given the request parameters
| accept-language
| en
When sending json search query "il, us"
Then results contain
| ID | display_name
| 0 | Illinois.*

View File

@@ -0,0 +1,33 @@
Feature: Result order for Geocoding
Testing that importance ordering returns sensible results
Scenario Outline: city order in street search
When sending json search query "<street>, <city>" with address
Then address of result 0 contains
| type | value
| <type> | <city>
Examples:
| type | city | street
| city | Zürich | Rigistr
| city | Karlsruhe | Sophienstr
| city | München | Karlstr
| city | Praha | Dlouhá
Scenario Outline: use more important city in street search
When sending json search query "<street>, <city>" with address
Then result addresses contain
| ID | country_code
| 0 | <country>
Examples:
| country | city | street
| gb | London | Main St
| gb | Manchester | Central Street
# https://trac.openstreetmap.org/ticket/5094
Scenario: housenumbers are ordered by complete match first
When sending json search query "4 Докукина Москва" with address
Then result addresses contain
| ID | house_number
| 0 | 4

View File

@@ -0,0 +1,172 @@
Feature: Search queries
Testing different queries and parameters
Scenario: Simple XML search
When sending xml search query "Schaan"
Then result 0 has attributes place_id,osm_type,osm_id
And result 0 has attributes place_rank,boundingbox
And result 0 has attributes lat,lon,display_name
And result 0 has attributes class,type,importance,icon
And result 0 has not attributes address
Scenario: Simple JSON search
When sending json search query "Vaduz"
And result 0 has attributes place_id,licence,icon,class,type
And result 0 has attributes osm_type,osm_id,boundingbox
And result 0 has attributes lat,lon,display_name,importance
And result 0 has not attributes address
Scenario: JSON search with addressdetails
When sending json search query "Montevideo" with address
Then address of result 0 is
| type | value
| city | Montevideo
| state | Montevideo
| country | Uruguay
| country_code | uy
Scenario: XML search with addressdetails
When sending xml search query "Inuvik" with address
Then address of result 0 is
| type | value
| town | Inuvik
| state | Northwest Territories
| country | Canada
| country_code | ca
Scenario: Address details with unknown class types
When sending json search query "foobar, Essen" with address
Then results contain
| ID | class | type
| 0 | leisure | hackerspace
And result addresses contain
| ID | address29
| 0 | foobar
And address of result 0 does not contain leisure,hackerspace
Scenario: Disabling deduplication
When sending json search query "Oxford Street, London"
Then there are no duplicates
Given the request parameters
| dedupe
| 0
When sending json search query "Oxford Street, London"
Then there are duplicates
Scenario: Search with bounded viewbox in right area
Given the request parameters
| bounded | viewbox
| 1 | -87.7,41.9,-87.57,41.85
When sending json search query "restaurant" with address
Then result addresses contain
| ID | city
| 0 | Chicago
Scenario: Search with bounded viewboxlbrt in right area
Given the request parameters
| bounded | viewboxlbrt
| 1 | -87.7,41.85,-87.57,41.9
When sending json search query "restaurant" with address
Then result addresses contain
| ID | city
| 0 | Chicago
Scenario: No POI search with unbounded viewbox
Given the request parameters
| viewbox
| -87.7,41.9,-87.57,41.85
When sending json search query "restaurant"
Then results contain
| display_name
| [^,]*(?i)restaurant.*
Scenario: bounded search remains within viewbox, even with no results
Given the request parameters
| bounded | viewbox
| 1 | -5.662003,43.54285,-5.6563282,43.5403125
When sending json search query "restaurant"
Then less than 1 result is returned
Scenario: bounded search remains within viewbox with results
Given the request parameters
| bounded | viewbox
| 1 | -5.662003,43.55,-5.6563282,43.5403125
When sending json search query "restaurant"
| lon | lat
| >= -5.662003 | >= 43.5403125
| <= -5.6563282| <= 43.55
Scenario: Prefer results within viewbox
Given the request parameters
| accept-language
| en
When sending json search query "royan" with address
Then result addresses contain
| ID | country
| 0 | France
Given the request parameters
| accept-language | viewbox
| en | 51.94,36.59,51.99,36.56
When sending json search query "royan" with address
Then result addresses contain
| ID | country
| 0 | Iran
Scenario: Overly large limit number for search results
Given the request parameters
| limit
| 1000
When sending json search query "Neustadt"
Then at most 50 results are returned
Scenario: Limit number of search results
Given the request parameters
| limit
| 4
When sending json search query "Neustadt"
Then exactly 4 results are returned
Scenario: Restrict to feature type country
Given the request parameters
| featureType
| country
When sending xml search query "Monaco"
Then results contain
| place_rank
| 4
Scenario: Restrict to feature type state
When sending xml search query "Berlin"
Then results contain
| ID | place_rank
| 0 | 1[56]
Given the request parameters
| featureType
| state
When sending xml search query "Berlin"
Then results contain
| place_rank
| [78]
Scenario: Restrict to feature type city
Given the request parameters
| featureType
| city
When sending xml search query "Monaco"
Then results contain
| place_rank
| 1[56789]
Scenario: Restrict to feature type settlement
When sending json search query "Everest"
Then results contain
| ID | display_name
| 0 | Mount Everest.*
Given the request parameters
| featureType
| settlement
When sending json search query "Everest"
Then results contain
| ID | display_name
| 0 | Everest.*

View File

@@ -0,0 +1,227 @@
Feature: Simple Tests
Simple tests for internal server errors and response format.
These tests should pass on any Nominatim installation.
Scenario Outline: Testing different parameters
Given the request parameters
| <parameter>
| <value>
When sending search query "Manchester"
Then the result is valid html
Given the request parameters
| <parameter>
| <value>
When sending html search query "Manchester"
Then the result is valid html
Given the request parameters
| <parameter>
| <value>
When sending xml search query "Manchester"
Then the result is valid xml
Given the request parameters
| <parameter>
| <value>
When sending json search query "Manchester"
Then the result is valid json
Given the request parameters
| <parameter>
| <value>
When sending jsonv2 search query "Manchester"
Then the result is valid json
Examples:
| parameter | value
| addressdetails | 1
| addressdetails | 0
| polygon | 1
| polygon | 0
| polygon_text | 1
| polygon_text | 0
| polygon_kml | 1
| polygon_kml | 0
| polygon_geojson | 1
| polygon_geojson | 0
| polygon_svg | 1
| polygon_svg | 0
| accept-language | de,en
| countrycodes | uk,ir
| bounded | 1
| bounded | 0
| exclude_place_ids| 385252,1234515
| limit | 1000
| dedupe | 1
| dedupe | 0
Scenario: Search with invalid output format
Given the request parameters
| format
| fd$#
When sending search query "Berlin"
Then the result is valid html
Scenario Outline: Simple Searches
When sending search query "<query>"
Then the result is valid html
When sending html search query "<query>"
Then the result is valid html
When sending xml search query "<query>"
Then the result is valid xml
When sending json search query "<query>"
Then the result is valid json
When sending jsonv2 search query "<query>"
Then the result is valid json
Examples:
| query
| New York, New York
| France
| 12, Main Street, Houston
| München
|
| hotels in nantes
| xywxkrf
| gh; foo()
| %#$@*&l;der#$!
| 234
| 47.4,8.3
Scenario: Empty XML search
When sending xml search query "xnznxvcx"
Then result header contains
| attr | value
| querystring | xnznxvcx
| polygon | false
| more_url | .*format=xml.*q=xnznxvcx.*
Scenario: Empty XML search with special XML characters
When sending xml search query "xfdghn&zxn"xvbyx<vxx>cssdex"
Then result header contains
| attr | value
| querystring | xfdghn&zxn"xvbyx<vxx>cssdex
| polygon | false
| more_url | .*format=xml.*q=xfdghn&zxn"xvbyx<vxx>cssdex.*
Scenario: Empty XML search with viewbox
Given the request parameters
| viewbox
| 12,45.13,77,33
When sending xml search query "xnznxvcx"
Then result header contains
| attr | value
| querystring | xnznxvcx
| polygon | false
| viewbox | 12,45.13,77,33
Scenario: Empty XML search with viewboxlbrt
Given the request parameters
| viewboxlbrt
| 12,34.13,77,45
When sending xml search query "xnznxvcx"
Then result header contains
| attr | value
| querystring | xnznxvcx
| polygon | false
| viewbox | 12,45.13,77,33
Scenario: Empty XML search with viewboxlbrt and viewbox
Given the request parameters
| viewbox | viewboxblrt
| 12,45.13,77,33 | 1,2,3,4
When sending xml search query "pub"
Then result header contains
| attr | value
| querystring | pub
| polygon | false
| viewbox | 12,45.13,77,33
Scenario Outline: Empty XML search with polygon values
Given the request parameters
| polygon
| <polyval>
When sending xml search query "xnznxvcx"
Then result header contains
| attr | value
| polygon | <result>
Examples:
| result | polyval
| false | 0
| true | 1
| true | True
| true | true
| true | false
| true | FALSE
| true | yes
| true | no
| true | '; delete from foobar; select '
Scenario: Empty XML search with exluded place ids
Given the request parameters
| exclude_place_ids
| 123,76,342565
When sending xml search query "jghrleoxsbwjer"
Then result header contains
| attr | value
| exclude_place_ids | 123,76,342565
Scenario Outline: Wrapping of legal jsonp search requests
Given the request parameters
| json_callback
| <data>
When sending json search query "Tokyo"
Then there is a json wrapper "<data>"
Examples:
| data
| foo
| FOO
| __world
| $me
| m1[4]
| d_r[$d]
Scenario Outline: Wrapping of illegal jsonp search requests
Given the request parameters
| json_callback
| <data>
When sending json search query "Tokyo"
Then a HTTP 400 is returned
Examples:
| data
| 1asd
| bar(foo)
| XXX['bad']
| foo; evil
Scenario Outline: Ignore jsonp parameter for anything but json
Given the request parameters
| json_callback
| 234
When sending json search query "Malibu"
Then a HTTP 400 is returned
Given the request parameters
| json_callback
| 234
When sending xml search query "Malibu"
Then the result is valid xml
Given the request parameters
| json_callback
| 234
When sending html search query "Malibu"
Then the result is valid html
Scenario: Empty JSON search
When sending json search query "YHlERzzx"
Then exactly 0 results are returned
Scenario: Empty JSONv2 search
When sending jsonv2 search query "Flubb XdfESSaZx"
Then exactly 0 results are returned
Scenario: Search for non-existing coordinates
When sending json search query "-21.0,-33.0"
Then exactly 0 results are returned

View File

@@ -0,0 +1,41 @@
Feature: Structured search queries
Testing correctness of results with
structured queries
Scenario: Country only
When sending json structured query with address
| country
| Canada
Then address of result 0 is
| type | value
| country | Canada
| country_code | ca
Scenario: Postcode only
When sending json structured query with address
| postalcode
| 22547
Then at least 1 result is returned
And results contain
| type
| post(al_)?code
And result addresses contain
| postcode
| 22547
Scenario: Street, postcode and country
When sending xml structured query with address
| street | postalcode | country
| Old Palace Road | GU2 7UP | United Kingdom
Then at least 1 result is returned
Then result header contains
| attr | value
| querystring | Old Palace Road, GU2 7UP, United Kingdom
Scenario: gihub #176
When sending json structured query with address
| city
| Washington
Then at least 1 result is returned

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View File

@@ -0,0 +1,13 @@
@DB
Feature: Import of relations by osm2pgsql
Testing specific relation problems related to members.
Scenario: Don't import empty waterways
Given the osm nodes:
| id | tags
| 1 | 'amenity' : 'prison', 'name' : 'foo'
And the osm relations:
| id | tags | members
| 1 | 'type' : 'waterway', 'waterway' : 'river', 'name' : 'XZ' | N1
When loading osm data
Then table place has no entry for R1

View File

@@ -0,0 +1,49 @@
@DB
Feature: Import of simple objects by osm2pgsql
Testing basic functions of osm2pgsql.
Scenario: Import simple objects
Given the osm nodes:
| id | tags
| 1 | 'amenity' : 'prison', 'name' : 'foo'
Given the osm nodes:
| id | geometry
| 100 | 0 0
| 101 | 0 0.1
| 102 | 0.1 0.2
| 200 | 0 0
| 201 | 0 1
| 202 | 1 1
| 203 | 1 0
Given the osm ways:
| id | tags | nodes
| 1 | 'shop' : 'toys', 'name' : 'tata' | 100 101 102
| 2 | 'ref' : '45' | 200 201 202 203 200
Given the osm relations:
| id | tags | members
| 1 | 'type' : 'multipolygon', 'tourism' : 'hotel', 'name' : 'XZ' | N1,W2
When loading osm data
Then table place contains
| object | class | type | name
| N1 | amenity | prison | 'name' : 'foo'
| W1 | shop | toys | 'name' : 'tata'
| R1 | tourism | hotel | 'name' : 'XZ'
Scenario: Import object with two main tags
Given the osm nodes:
| id | tags
| 1 | 'tourism' : 'hotel', 'amenity' : 'restaurant', 'name' : 'foo'
When loading osm data
Then table place contains
| object | class | type | name
| N1:tourism | tourism | hotel | 'name' : 'foo'
| N1:amenity | amenity | restaurant | 'name' : 'foo'
Scenario: Import stand-alone house number with postcode
Given the osm nodes:
| id | tags
| 1 | 'addr:housenumber' : '4', 'addr:postcode' : '3345'
When loading osm data
Then table place contains
| object | class | type
| N1 | place | house

View File

@@ -0,0 +1,30 @@
@DB
Feature: Update of relations by osm2pgsql
Testing relation update by osm2pgsql.
Scenario: Remove all members of a relation
Given the osm nodes:
| id | tags
| 1 | 'amenity' : 'prison', 'name' : 'foo'
Given the osm nodes:
| id | geometry
| 200 | 0 0
| 201 | 0 0.0001
| 202 | 0.0001 0.0001
| 203 | 0.0001 0
Given the osm ways:
| id | tags | nodes
| 2 | 'ref' : '45' | 200 201 202 203 200
Given the osm relations:
| id | tags | members
| 1 | 'type' : 'multipolygon', 'tourism' : 'hotel', 'name' : 'XZ' | W2
When loading osm data
Then table place contains
| object | class | type | name
| R1 | tourism | hotel | 'name' : 'XZ'
Given the osm relations:
| action | id | tags | members
| M | 1 | 'type' : 'multipolygon', 'tourism' : 'hotel', 'name' : 'XZ' | N1
When updating osm data
Then table place has no entry for R1

View File

@@ -0,0 +1,22 @@
@DB
Feature: Update of simple objects by osm2pgsql
Testing basic update functions of osm2pgsql.
Scenario: Import object with two main tags
Given the osm nodes:
| id | tags
| 1 | 'tourism' : 'hotel', 'amenity' : 'restaurant', 'name' : 'foo'
When loading osm data
Then table place contains
| object | class | type | name
| N1:tourism | tourism | hotel | 'name' : 'foo'
| N1:amenity | amenity | restaurant | 'name' : 'foo'
Given the osm nodes:
| action | id | tags
| M | 1 | 'tourism' : 'hotel', 'name' : 'foo'
When updating osm data
Then table place has no entry for N1:amenity
And table place contains
| object | class | type | name
| N1:tourism | tourism | hotel | 'name' : 'foo'