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