]> git.openstreetmap.org Git - nominatim.git/blob - test/bdd/features/db/import/country.feature
prepare release 5.1.0.post13
[nominatim.git] / test / bdd / features / db / import / country.feature
1 Feature: Country handling
2     Tests for import and use of country information
3
4     Scenario: Country names from OSM country relations are added
5         Given the places
6             | osm  | class    | type           | admin | name+name:xy | country | geometry |
7             | R1   | boundary | administrative | 2     | Loudou       | de      | (9 52, 9 53, 10 52, 9 52) |
8         Given the places
9             | osm  | class    | type          | name  | geometry   |
10             | N1   | place    | town          | Wenig | country:de |
11         When importing
12         When geocoding "Wenig, Loudou"
13         Then the result set contains
14             | object | display_name |
15             | N1     | Wenig, Deutschland |
16         When geocoding "Wenig"
17             | accept-language |
18             | xy,en |
19         Then the result set contains
20             | object | display_name |
21             | N1     | Wenig, Loudou |
22
23     Scenario: OSM country relations outside expected boundaries are ignored for naming
24         Given the grid
25             | 1 |  | 2 |
26             | 4 |  | 3 |
27         Given the places
28             | osm  | class    | type           | admin | name+name:xy | country | geometry |
29             | R1   | boundary | administrative | 2     | Loudou       | de      | (1,2,3,4,1) |
30         Given the places
31             | osm  | class    | type          | name  | geometry   |
32             | N1   | place    | town          | Wenig | country:de |
33         When importing
34         When geocoding "Wenig"
35             | accept-language |
36             | xy,en |
37         Then the result set contains
38             | object | display_name |
39             | N1     | Wenig, Germany |
40
41     Scenario: Pre-defined country names are used
42         Given the grid with origin CH
43             | 1 |
44         Given the places
45             | osm  | class    | type          | name  | geometry   |
46             | N1   | place    | town          | Ingb  | 1          |
47         When importing
48         And geocoding "Ingb"
49             | accept-language |
50             | en,de |
51         Then the result set contains
52             | object | display_name |
53             | N1     | Ingb, Switzerland |
54
55     Scenario: For overlapping countries, pre-defined countries are tie-breakers
56         Given the grid with origin US
57             | 1 |   | 2 |   | 5 |
58             |   | 9 |   | 8 |   |
59             | 4 |   | 3 |   | 6 |
60         Given the named places
61             | osm  | class    | type           | admin | country | geometry |
62             | R1   | boundary | administrative | 2     | de      | (1,5,6,4,1) |
63             | R2   | boundary | administrative | 2     | us      | (1,2,3,4,1) |
64         And the named places
65             | osm  | class    | type  | geometry   |
66             | N1   | place    | town  | 9 |
67             | N2   | place    | town  | 8 |
68         When importing
69         Then placex contains
70             | object | country_code |
71             | N1     | us           |
72             | N2     | de           |
73
74     Scenario: For overlapping countries outside pre-define countries prefer smaller partition
75         Given the grid with origin US
76             | 1 |   | 2 |   | 5 |
77             |   | 9 |   | 8 |   |
78             | 4 |   | 3 |   | 6 |
79         Given the named places
80             | osm  | class    | type           | admin | country | geometry |
81             | R1   | boundary | administrative | 2     | ch      | (1,5,6,4,1) |
82             | R2   | boundary | administrative | 2     | de      | (1,2,3,4,1) |
83         And the named places
84             | osm  | class    | type  | geometry   |
85             | N1   | place    | town  | 9 |
86             | N2   | place    | town  | 8 |
87         When importing
88         Then placex contains
89             | object | country_code |
90             | N1     | de           |
91             | N2     | ch           |