]> git.openstreetmap.org Git - nominatim.git/blob - test/bdd/db/import/placex.feature
Merge pull request #661 from mtmail/travis-ci-badge
[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 | country_code | calculated_country_code |
12           | N1     | None         | 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 | country_code | calculated_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 | country_code | calculated_country_code |
30           | R1     | 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 | country_code | calculated_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: admin level is default 15
51         Given the named places
52           | osm | class   | type   |
53           | N1  | amenity | prison |
54         When importing
55         Then placex contains
56           | object | admin_level |
57           | N1     | 15          |
58
59     Scenario: admin level is never larger than 15
60         Given the named places
61           | osm | class   | type   | admin |
62           | N1  | amenity | prison | 16 |
63         When importing
64         Then placex contains
65           | object | admin_level |
66           | N1     | 15          |
67
68     Scenario: postcode node without postcode is dropped
69         Given the places
70           | osm | class   | type     | name+ref |
71           | N1  | place   | postcode | 12334    |
72         When importing
73         Then placex has no entry for N1
74
75     Scenario: postcode boundary without postcode is dropped
76         Given the places
77           | osm | class    | type        | name+ref | geometry |
78           | R1  | boundary | postal_code | 554476   | poly-area:0.1 |
79         When importing
80         Then placex has no entry for R1
81
82     Scenario: search and address ranks for GB post codes correctly assigned
83         Given the places
84          | osm  | class | type     | postcode | geometry |
85          | N1   | place | postcode | E45 2CD  | country:gb |
86          | N2   | place | postcode | E45 2    | country:gb |
87          | N3   | place | postcode | Y45      | country:gb |
88         When importing
89         Then placex contains
90          | object | postcode | calculated_country_code | rank_search | rank_address |
91          | N1     | E45 2CD  | gb                      | 25          | 5 |
92          | N2     | E45 2    | gb                      | 23          | 5 |
93          | N3     | Y45      | gb                      | 21          | 5 |
94
95     Scenario: wrongly formatted GB postcodes are down-ranked
96         Given the places
97          | osm  | class | type     | postcode | geometry |
98          | N1   | place | postcode | EA452CD  | country:gb |
99          | N2   | place | postcode | E45 23   | country:gb |
100          | N3   | place | postcode | y45      | country:gb |
101         When importing
102         Then placex contains
103          | object | calculated_country_code | rank_search | rank_address |
104          | N1     | gb                      | 30          | 30 |
105          | N2     | gb                      | 30          | 30 |
106          | N3     | gb                      | 30          | 30 |
107
108     Scenario: search and address rank for DE postcodes correctly assigned
109         Given the places
110          | osm | class | type     | postcode | geometry |
111          | N1  | place | postcode | 56427    | country:de |
112          | N2  | place | postcode | 5642     | country:de |
113          | N3  | place | postcode | 5642A    | country:de |
114          | N4  | place | postcode | 564276   | country:de |
115         When importing
116         Then placex contains
117          | object | calculated_country_code | rank_search | rank_address |
118          | N1     | de                      | 21          | 11 |
119          | N2     | de                      | 30          | 30 |
120          | N3     | de                      | 30          | 30 |
121          | N4     | de                      | 30          | 30 |
122
123     Scenario: search and address rank for other postcodes are correctly assigned
124         Given the places
125          | osm | class | type     | postcode | geometry |
126          | N1  | place | postcode | 1        | country:ca |
127          | N2  | place | postcode | X3       | country:ca |
128          | N3  | place | postcode | 543      | country:ca |
129          | N4  | place | postcode | 54dc     | country:ca |
130          | N5  | place | postcode | 12345    | country:ca |
131          | N6  | place | postcode | 55TT667  | country:ca |
132          | N7  | place | postcode | 123-65   | country:ca |
133          | N8  | place | postcode | 12 445 4 | country:ca |
134          | N9  | place | postcode | A1:bc10  | country:ca |
135         When importing
136         Then placex contains
137          | object | calculated_country_code | rank_search | rank_address |
138          | N1     | ca                      | 21          | 11 |
139          | N2     | ca                      | 21          | 11 |
140          | N3     | ca                      | 21          | 11 |
141          | N4     | ca                      | 21          | 11 |
142          | N5     | ca                      | 21          | 11 |
143          | N6     | ca                      | 21          | 11 |
144          | N7     | ca                      | 25          | 11 |
145          | N8     | ca                      | 25          | 11 |
146          | N9     | ca                      | 25          | 11 |
147
148     Scenario: search and address ranks for places are correctly assigned
149         Given the named places
150           | osm  | class     | type      |
151           | N1   | foo       | bar       |
152           | N11  | place     | Continent |
153           | N12  | place     | continent |
154           | N13  | place     | sea       |
155           | N14  | place     | country   |
156           | N15  | place     | state     |
157           | N16  | place     | region    |
158           | N17  | place     | county    |
159           | N18  | place     | city      |
160           | N19  | place     | island    |
161           | N20  | place     | town      |
162           | N21  | place     | village   |
163           | N22  | place     | hamlet    |
164           | N23  | place     | municipality |
165           | N24  | place     | district     |
166           | N25  | place     | unincorporated_area |
167           | N26  | place     | borough             |
168           | N27  | place     | suburb              |
169           | N28  | place     | croft               |
170           | N29  | place     | subdivision         |
171           | N30  | place     | isolated_dwelling   |
172           | N31  | place     | farm                |
173           | N32  | place     | locality            |
174           | N33  | place     | islet               |
175           | N34  | place     | mountain_pass       |
176           | N35  | place     | neighbourhood       |
177           | N36  | place     | house               |
178           | N37  | place     | building            |
179           | N38  | place     | houses              |
180         And the named places
181           | osm  | class     | type      | extra+locality |
182           | N100 | place     | locality  | townland |
183         And the named places
184           | osm  | class     | type      | extra+capital |
185           | N101 | place     | city      | yes |
186         When importing
187         Then placex contains
188           | object | rank_search | rank_address |
189           | N1     | 30          | 30 |
190           | N11    | 30          | 30 |
191           | N12    | 2           | 2 |
192           | N13    | 2           | 0 |
193           | N14    | 4           | 4 |
194           | N15    | 8           | 8 |
195           | N16    | 18          | 0 |
196           | N17    | 12          | 12 |
197           | N18    | 16          | 16 |
198           | N19    | 17          | 0 |
199           | N20    | 18          | 16 |
200           | N21    | 19          | 16 |
201           | N22    | 19          | 16 |
202           | N23    | 19          | 16 |
203           | N24    | 19          | 16 |
204           | N25    | 19          | 16 |
205           | N26    | 19          | 16 |
206           | N27    | 20          | 20 |
207           | N28    | 20          | 20 |
208           | N29    | 20          | 20 |
209           | N30    | 20          | 20 |
210           | N31    | 20          | 0 |
211           | N32    | 20          | 0 |
212           | N33    | 20          | 0 |
213           | N34    | 20          | 0 |
214           | N100   | 20          | 20 |
215           | N101   | 15          | 16 |
216           | N35    | 22          | 22 |
217           | N36    | 30          | 30 |
218           | N37    | 30          | 30 |
219           | N38    | 28          | 0 |
220
221     Scenario: search and address ranks for boundaries are correctly assigned
222         Given the named places
223           | osm | class    | type |
224           | N1  | boundary | administrative |
225         And the named places
226           | osm | class    | type           | geometry |
227           | W10 | boundary | administrative | 10 10, 11 11 |
228         And the named places
229           | osm | class    | type           | admin | geometry |
230           | R20 | boundary | administrative | 2     | (1 1, 2 2, 1 2, 1 1) |
231           | R21 | boundary | administrative | 32    | (3 3, 4 4, 3 4, 3 3) |
232           | R22 | boundary | nature_park    | 6     | (0 0, 1 0, 0 1, 0 0) |
233           | R23 | boundary | natural_reserve| 10    | (0 0, 1 1, 1 0, 0 0) |
234         When importing
235         Then placex has no entry for N1
236         And placex has no entry for W10
237         And placex contains
238           | object | rank_search | rank_address |
239           | R20    | 4           | 4 |
240           | R21    | 30          | 30 |
241           | R22    | 12          | 0 |
242           | R23    | 20          | 0 |
243
244     Scenario: search and address ranks for highways correctly assigned
245         Given the scene roads-with-pois
246         And the places
247           | osm | class    | type  |
248           | N1  | highway  | bus_stop |
249         And the places
250           | osm | class    | type         | geometry |
251           | W1  | highway  | primary      | :w-south |
252           | W2  | highway  | secondary    | :w-south |
253           | W3  | highway  | tertiary     | :w-south |
254           | W4  | highway  | residential  | :w-north |
255           | W5  | highway  | unclassified | :w-north |
256           | W6  | highway  | something    | :w-north |
257         When importing
258         Then placex contains
259           | object | rank_search | rank_address |
260           | N1     | 30          | 30 |
261           | W1     | 26          | 26 |
262           | W2     | 26          | 26 |
263           | W3     | 26          | 26 |
264           | W4     | 26          | 26 |
265           | W5     | 26          | 26 |
266           | W6     | 26          | 26 |
267
268     Scenario: rank and inclusion of landuses
269         Given the named places
270           | osm | class   | type |
271           | N2  | landuse | residential |
272         And the named places
273           | osm | class   | type        | geometry |
274           | W2  | landuse | residential | 1 1, 1 1.1 |
275           | W4  | landuse | residential | poly-area:0.1 |
276           | R2  | landuse | residential | poly-area:0.05 |
277           | R3  | landuse | forrest     | poly-area:0.5 |
278         When importing
279         Then placex contains
280           | object | rank_search | rank_address |
281           | N2     | 30          | 30 |
282           | W2     | 30          | 30 |
283           | W4     | 22          | 22 |
284           | R2     | 22          | 22 |
285           | R3     | 22          | 0 |
286
287     Scenario: rank and inclusion of naturals
288        Given the named places
289           | osm | class   | type |
290           | N2  | natural | peak |
291           | N4  | natural | volcano |
292           | N5  | natural | foobar |
293        And the named places
294           | osm | class   | type           | geometry |
295           | W2  | natural | mountain_range | 12 12,11 11 |
296           | W3  | natural | foobar         | 13 13,13.1 13 |
297           | R3  | natural | volcano        | poly-area:0.1 |
298           | R4  | natural | foobar         | poly-area:0.5 |
299           | R5  | natural | sea            | poly-area:5.0 |
300           | R6  | natural | sea            | poly-area:0.01 |
301        When importing
302        Then placex contains
303           | object | rank_search | rank_address |
304           | N2     | 18          | 0 |
305           | N4     | 18          | 0 |
306           | N5     | 30          | 30 |
307           | W2     | 18          | 0 |
308           | R3     | 18          | 0 |
309           | R4     | 22          | 0 |
310           | R5     | 4           | 4 |
311           | R6     | 4           | 4 |
312           | W3     | 30          | 30 |
313