]> git.openstreetmap.org Git - nominatim.git/blob - test/bdd/db/import/placex.feature
move country names into separate include files
[nominatim.git] / test / bdd / db / import / placex.feature
1 @DB
2 Feature: Import into placex
3     Tests that data in placex is completed correctly.
4
5     Scenario: No country code tag is available
6         Given the named places
7           | osm | class   | type     | geometry   |
8           | N1  | highway | primary  | country:us |
9         When importing
10         Then placex contains
11           | object | addr+country | country_code |
12           | N1     | -            | us           |
13
14     Scenario: Location overwrites country code tag
15         Given the named places
16           | osm | class   | type     | country | geometry |
17           | N1  | highway | primary  | de      | country:us |
18         When importing
19         Then placex contains
20           | object | addr+country | country_code |
21           | N1     | de           | us           |
22
23     Scenario: Country code tag overwrites location for countries
24         Given the named places
25           | osm | class    | type            | admin | country | geometry |
26           | R1  | boundary | administrative  | 2     | de      | (-100 40, -101 40, -101 41, -100 41, -100 40) |
27         When importing
28         Then placex contains
29           | object | rank_search| addr+country | country_code |
30           | R1     | 4          | de           | de           |
31
32     Scenario: Illegal country code tag for countries is ignored
33         Given the named places
34           | osm | class    | type            | admin | country | geometry |
35           | R1  | boundary | administrative  | 2     | xx      | (-100 40, -101 40, -101 41, -100 41, -100 40) |
36         When importing
37         Then placex contains
38           | object | addr+country | country_code |
39           | R1     | xx           | us           |
40
41     Scenario: admin level is copied over
42         Given the named places
43           | osm | class | type      | admin |
44           | N1  | place | state     | 3     |
45         When importing
46         Then placex contains
47           | object | admin_level |
48           | N1     | 3           |
49
50     Scenario: postcode node without postcode is dropped
51         Given the places
52           | osm | class   | type     | name+ref |
53           | N1  | place   | postcode | 12334    |
54         When importing
55         Then placex has no entry for N1
56
57     Scenario: postcode boundary without postcode is dropped
58         Given the places
59           | osm | class    | type        | name+ref | geometry |
60           | R1  | boundary | postal_code | 554476   | poly-area:0.1 |
61         When importing
62         Then placex has no entry for R1
63
64     Scenario: search and address ranks for boundaries are correctly assigned
65         Given the named places
66           | osm | class    | type |
67           | N1  | boundary | administrative |
68         And the named places
69           | osm | class    | type           | geometry |
70           | W10 | boundary | administrative | 10 10, 11 11 |
71         And the named places
72           | osm | class    | type           | admin | geometry |
73           | R20 | boundary | administrative | 2     | (1 1, 2 2, 1 2, 1 1) |
74           | R21 | boundary | administrative | 32    | (3 3, 4 4, 3 4, 3 3) |
75           | R22 | boundary | nature_park    | 6     | (0 0, 1 0, 0 1, 0 0) |
76           | R23 | boundary | natural_reserve| 10    | (0 0, 1 1, 1 0, 0 0) |
77         And the named places
78           | osm | class | type    | geometry |
79           | R40 | place | country | (1 1, 2 2, 1 2, 1 1) |
80           | R41 | place | state   | (3 3, 4 4, 3 4, 3 3) |
81         When importing
82         Then placex has no entry for N1
83         And placex has no entry for W10
84         And placex contains
85           | object | rank_search | rank_address |
86           | R20    | 4           | 4 |
87           | R21    | 25          | 0 |
88           | R22    | 25          | 0 |
89           | R23    | 25          | 0 |
90           | R40    | 4           | 0 |
91           | R41    | 8           | 0 |
92
93     Scenario: search and address ranks for highways correctly assigned
94         Given the scene roads-with-pois
95         And the places
96           | osm | class    | type  |
97           | N1  | highway  | bus_stop |
98         And the places
99           | osm | class    | type         | geometry |
100           | W1  | highway  | primary      | :w-south |
101           | W2  | highway  | secondary    | :w-south |
102           | W3  | highway  | tertiary     | :w-south |
103           | W4  | highway  | residential  | :w-north |
104           | W5  | highway  | unclassified | :w-north |
105           | W6  | highway  | something    | :w-north |
106         When importing
107         Then placex contains
108           | object | rank_search | rank_address |
109           | N1     | 30          | 30 |
110           | W1     | 26          | 26 |
111           | W2     | 26          | 26 |
112           | W3     | 26          | 26 |
113           | W4     | 26          | 26 |
114           | W5     | 26          | 26 |
115           | W6     | 30          | 30 |
116
117     Scenario: rank and inclusion of landuses
118         Given the named places
119           | osm | class   | type |
120           | N2  | landuse | residential |
121         And the named places
122           | osm | class   | type        | geometry |
123           | W2  | landuse | residential | 1 1, 1 1.1 |
124           | W4  | landuse | residential | poly-area:0.1 |
125           | R2  | landuse | residential | poly-area:0.05 |
126           | R3  | landuse | forrest     | poly-area:0.5 |
127         When importing
128         Then placex contains
129           | object | rank_search | rank_address |
130           | N2     | 30          | 30 |
131           | W2     | 30          | 30 |
132           | W4     | 22          | 22 |
133           | R2     | 22          | 22 |
134           | R3     | 22          |  0 |
135
136     Scenario: rank and inclusion of naturals
137        Given the named places
138           | osm | class   | type |
139           | N2  | natural | peak |
140           | N4  | natural | volcano |
141           | N5  | natural | foobar |
142        And the named places
143           | osm | class   | type           | geometry |
144           | W2  | natural | mountain_range | 12 12,11 11 |
145           | W3  | natural | foobar         | 13 13,13.1 13 |
146           | R3  | natural | volcano        | poly-area:0.1 |
147           | R4  | natural | foobar         | poly-area:0.5 |
148           | R5  | natural | sea            | poly-area:5.0 |
149           | R6  | natural | sea            | poly-area:0.01 |
150        When importing
151        Then placex contains
152           | object | rank_search | rank_address |
153           | N2     | 18          | 0 |
154           | N4     | 18          | 0 |
155           | N5     | 22          | 0 |
156           | W2     | 18          | 0 |
157           | R3     | 18          | 0 |
158           | R4     | 22          | 0 |
159           | R5     | 4           | 0 |
160           | R6     | 4           | 0 |
161           | W3     | 22          | 0 |
162
163     Scenario: boundary ways for countries and states are ignored
164         Given the named places
165           | osm | class    | type           | admin | geometry |
166           | W4  | boundary | administrative | 2     | poly-area:0.1 |
167           | R4  | boundary | administrative | 2     | poly-area:0.1 |
168           | W5  | boundary | administrative | 3     | poly-area:0.1 |
169           | R5  | boundary | administrative | 3     | poly-area:0.1 |
170           | W6  | boundary | administrative | 4     | poly-area:0.1 |
171           | R6  | boundary | administrative | 4     | poly-area:0.1 |
172           | W7  | boundary | administrative | 5     | poly-area:0.1 |
173           | R7  | boundary | administrative | 5     | poly-area:0.1 |
174        When importing
175        Then placex contains exactly
176            | object |
177            | R4     |
178            | R5     |
179            | R6     |
180            | W7     |
181            | R7     |