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