]> git.openstreetmap.org Git - nominatim.git/blob - test/bdd/db/import/placex.feature
Merge remote-tracking branch 'upstream/master'
[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 GB post codes correctly assigned
65         Given the places
66          | osm  | class | type     | postcode | geometry |
67          | N1   | place | postcode | E45 2CD  | country:gb |
68          | N2   | place | postcode | E45 2    | country:gb |
69          | N3   | place | postcode | Y45      | country:gb |
70         When importing
71         Then placex contains
72          | object | addr+postcode | country_code | rank_search | rank_address |
73          | N1     | E45 2CD       | gb           | 25          | 5 |
74          | N2     | E45 2         | gb           | 23          | 5 |
75          | N3     | Y45           | gb           | 21          | 5 |
76
77     Scenario: wrongly formatted GB postcodes are down-ranked
78         Given the places
79          | osm  | class | type     | postcode | geometry |
80          | N1   | place | postcode | EA452CD  | country:gb |
81          | N2   | place | postcode | E45 23   | country:gb |
82         When importing
83         Then placex contains
84          | object | country_code | rank_search | rank_address |
85          | N1     | gb           | 30          | 30 |
86          | N2     | gb           | 30          | 30 |
87
88     Scenario: search and address rank for DE postcodes correctly assigned
89         Given the places
90          | osm | class | type     | postcode | geometry |
91          | N1  | place | postcode | 56427    | country:de |
92          | N2  | place | postcode | 5642     | country:de |
93          | N3  | place | postcode | 5642A    | country:de |
94          | N4  | place | postcode | 564276   | country:de |
95         When importing
96         Then placex contains
97          | object | country_code | rank_search | rank_address |
98          | N1     | de           | 21          | 11 |
99          | N2     | de           | 30          | 30 |
100          | N3     | de           | 30          | 30 |
101          | N4     | de           | 30          | 30 |
102
103     Scenario: search and address rank for other postcodes are correctly assigned
104         Given the places
105          | osm | class | type     | postcode | geometry |
106          | N1  | place | postcode | 1        | country:ca |
107          | N2  | place | postcode | X3       | country:ca |
108          | N3  | place | postcode | 543      | country:ca |
109          | N4  | place | postcode | 54dc     | country:ca |
110          | N5  | place | postcode | 12345    | country:ca |
111          | N6  | place | postcode | 55TT667  | country:ca |
112          | N7  | place | postcode | 123-65   | country:ca |
113          | N8  | place | postcode | 12 445 4 | country:ca |
114          | N9  | place | postcode | A1:bc10  | country:ca |
115         When importing
116         Then placex contains
117          | object | country_code | rank_search | rank_address |
118          | N1     | ca           | 21          | 11 |
119          | N2     | ca           | 21          | 11 |
120          | N3     | ca           | 21          | 11 |
121          | N4     | ca           | 21          | 11 |
122          | N5     | ca           | 21          | 11 |
123          | N6     | ca           | 21          | 11 |
124          | N7     | ca           | 25          | 11 |
125          | N8     | ca           | 25          | 11 |
126          | N9     | ca           | 25          | 11 |
127
128     Scenario: search and address ranks for boundaries are correctly assigned
129         Given the named places
130           | osm | class    | type |
131           | N1  | boundary | administrative |
132         And the named places
133           | osm | class    | type           | geometry |
134           | W10 | boundary | administrative | 10 10, 11 11 |
135         And the named places
136           | osm | class    | type           | admin | geometry |
137           | R20 | boundary | administrative | 2     | (1 1, 2 2, 1 2, 1 1) |
138           | R21 | boundary | administrative | 32    | (3 3, 4 4, 3 4, 3 3) |
139           | R22 | boundary | nature_park    | 6     | (0 0, 1 0, 0 1, 0 0) |
140           | R23 | boundary | natural_reserve| 10    | (0 0, 1 1, 1 0, 0 0) |
141         And the named places
142           | osm | class | type    | geometry |
143           | R40 | place | country | (1 1, 2 2, 1 2, 1 1) |
144           | R41 | place | state   | (3 3, 4 4, 3 4, 3 3) |
145         When importing
146         Then placex has no entry for N1
147         And placex has no entry for W10
148         And placex contains
149           | object | rank_search | rank_address |
150           | R20    | 4           | 4 |
151           | R21    | 25          | 0 |
152           | R22    | 25          | 0 |
153           | R23    | 25          | 0 |
154           | R40    | 4           | 0 |
155           | R41    | 8           | 0 |
156
157     Scenario: search and address ranks for highways correctly assigned
158         Given the scene roads-with-pois
159         And the places
160           | osm | class    | type  |
161           | N1  | highway  | bus_stop |
162         And the places
163           | osm | class    | type         | geometry |
164           | W1  | highway  | primary      | :w-south |
165           | W2  | highway  | secondary    | :w-south |
166           | W3  | highway  | tertiary     | :w-south |
167           | W4  | highway  | residential  | :w-north |
168           | W5  | highway  | unclassified | :w-north |
169           | W6  | highway  | something    | :w-north |
170         When importing
171         Then placex contains
172           | object | rank_search | rank_address |
173           | N1     | 30          |  0 |
174           | W1     | 26          | 26 |
175           | W2     | 26          | 26 |
176           | W3     | 26          | 26 |
177           | W4     | 26          | 26 |
178           | W5     | 26          | 26 |
179           | W6     | 26          | 26 |
180
181     Scenario: rank and inclusion of landuses
182         Given the named places
183           | osm | class   | type |
184           | N2  | landuse | residential |
185         And the named places
186           | osm | class   | type        | geometry |
187           | W2  | landuse | residential | 1 1, 1 1.1 |
188           | W4  | landuse | residential | poly-area:0.1 |
189           | R2  | landuse | residential | poly-area:0.05 |
190           | R3  | landuse | forrest     | poly-area:0.5 |
191         When importing
192         Then placex contains
193           | object | rank_search | rank_address |
194           | N2     | 30          |  0 |
195           | W2     | 30          |  0 |
196           | W4     | 22          | 22 |
197           | R2     | 22          | 22 |
198           | R3     | 22          |  0 |
199
200     Scenario: rank and inclusion of naturals
201        Given the named places
202           | osm | class   | type |
203           | N2  | natural | peak |
204           | N4  | natural | volcano |
205           | N5  | natural | foobar |
206        And the named places
207           | osm | class   | type           | geometry |
208           | W2  | natural | mountain_range | 12 12,11 11 |
209           | W3  | natural | foobar         | 13 13,13.1 13 |
210           | R3  | natural | volcano        | poly-area:0.1 |
211           | R4  | natural | foobar         | poly-area:0.5 |
212           | R5  | natural | sea            | poly-area:5.0 |
213           | R6  | natural | sea            | poly-area:0.01 |
214        When importing
215        Then placex contains
216           | object | rank_search | rank_address |
217           | N2     | 18          | 0 |
218           | N4     | 18          | 0 |
219           | N5     | 30          | 30 |
220           | W2     | 18          | 0 |
221           | R3     | 18          | 0 |
222           | R4     | 30          | 30 |
223           | R5     | 4           | 0 |
224           | R6     | 4           | 0 |
225           | W3     | 30          | 30 |
226
227     Scenario: boundary ways for countries and states are ignored
228         Given the named places
229           | osm | class    | type           | admin | geometry |
230           | W4  | boundary | administrative | 2     | poly-area:0.1 |
231           | R4  | boundary | administrative | 2     | poly-area:0.1 |
232           | W5  | boundary | administrative | 3     | poly-area:0.1 |
233           | R5  | boundary | administrative | 3     | poly-area:0.1 |
234           | W6  | boundary | administrative | 4     | poly-area:0.1 |
235           | R6  | boundary | administrative | 4     | poly-area:0.1 |
236           | W7  | boundary | administrative | 5     | poly-area:0.1 |
237           | R7  | boundary | administrative | 5     | poly-area:0.1 |
238        When importing
239        Then placex contains exactly
240            | object |
241            | R4     |
242            | R5     |
243            | R6     |
244            | W7     |
245            | R7     |