2 Feature: Import into placex
3 Tests that data in placex is completed correctly.
5 Scenario: No country code tag is available
7 | osm_id | class | type | name | geometry
8 | 1 | highway | primary | 'name' : 'A1' | country:us
10 Then table placex contains
11 | object | country_code | calculated_country_code |
14 Scenario: Location overwrites country code tag
15 Given the scene country
17 | osm_id | class | type | name | country_code | geometry
18 | 1 | highway | primary | 'name' : 'A1' | de | :us
20 Then table placex contains
21 | object | country_code | calculated_country_code |
24 Scenario: Country code tag overwrites location for countries
26 | osm_type | osm_id | class | type | admin_level | name | country_code | geometry
27 | R | 1 | boundary | administrative | 2 | 'name' : 'foo' | de | (-100 40, -101 40, -101 41, -100 41, -100 40)
29 Then table placex contains
30 | object | country_code | calculated_country_code |
33 Scenario: Illegal country code tag for countries is ignored
35 | osm_type | osm_id | class | type | admin_level | name | country_code | geometry
36 | R | 1 | boundary | administrative | 2 | 'name' : 'foo' | xx | (-100 40, -101 40, -101 41, -100 41, -100 40)
38 Then table placex contains
39 | object | country_code | calculated_country_code |
42 Scenario: admin level is copied over
44 | osm_id | class | type | admin_level | name
45 | 1 | place | state | 3 | 'name' : 'foo'
47 Then table placex contains
48 | object | admin_level |
51 Scenario: admin level is default 15
53 | osm_id | class | type | name
54 | 1 | amenity | prison | 'name' : 'foo'
56 Then table placex contains
57 | object | admin_level |
60 Scenario: admin level is never larger than 15
62 | osm_id | class | type | name | admin_level
63 | 1 | amenity | prison | 'name' : 'foo' | 16
65 Then table placex contains
66 | object | admin_level |
70 Scenario: postcode node without postcode is dropped
72 | osm_id | class | type
73 | 1 | place | postcode
75 Then table placex has no entry for N1
77 Scenario: postcode boundary without postcode is dropped
79 | osm_type | osm_id | class | type | geometry
80 | R | 1 | boundary | postal_code | poly-area:0.1
82 Then table placex has no entry for R1
84 Scenario: search and address ranks for GB post codes correctly assigned
86 | osm_id | class | type | postcode | geometry
87 | 1 | place | postcode | E45 2CD | country:gb
88 | 2 | place | postcode | E45 2 | country:gb
89 | 3 | place | postcode | Y45 | country:gb
91 Then table placex contains
92 | object | postcode | calculated_country_code | rank_search | rank_address
93 | N1 | E45 2CD | gb | 25 | 5
94 | N2 | E45 2 | gb | 23 | 5
95 | N3 | Y45 | gb | 21 | 5
97 Scenario: wrongly formatted GB postcodes are down-ranked
99 | osm_id | class | type | postcode | geometry
100 | 1 | place | postcode | EA452CD | country:gb
101 | 2 | place | postcode | E45 23 | country:gb
102 | 3 | place | postcode | y45 | country:gb
104 Then table placex contains
105 | object | calculated_country_code | rank_search | rank_address
110 Scenario: search and address rank for DE postcodes correctly assigned
111 Given the place nodes
112 | osm_id | class | type | postcode | geometry
113 | 1 | place | postcode | 56427 | country:de
114 | 2 | place | postcode | 5642 | country:de
115 | 3 | place | postcode | 5642A | country:de
116 | 4 | place | postcode | 564276 | country:de
118 Then table placex contains
119 | object | calculated_country_code | rank_search | rank_address
125 Scenario: search and address rank for other postcodes are correctly assigned
126 Given the place nodes
127 | osm_id | class | type | postcode | geometry
128 | 1 | place | postcode | 1 | country:ca
129 | 2 | place | postcode | X3 | country:ca
130 | 3 | place | postcode | 543 | country:ca
131 | 4 | place | postcode | 54dc | country:ca
132 | 5 | place | postcode | 12345 | country:ca
133 | 6 | place | postcode | 55TT667 | country:ca
134 | 7 | place | postcode | 123-65 | country:ca
135 | 8 | place | postcode | 12 445 4 | country:ca
136 | 9 | place | postcode | A1:bc10 | country:ca
138 Then table placex contains
139 | object | calculated_country_code | rank_search | rank_address
151 Scenario: search and address ranks for places are correctly assigned
152 Given the named place nodes
153 | osm_id | class | type |
155 | 11 | place | Continent |
156 | 12 | place | continent |
158 | 14 | place | country |
159 | 15 | place | state |
160 | 16 | place | region |
161 | 17 | place | county |
162 | 18 | place | city |
163 | 19 | place | island |
164 | 20 | place | town |
165 | 21 | place | village |
166 | 22 | place | hamlet |
167 | 23 | place | municipality |
168 | 24 | place | district |
169 | 25 | place | unincorporated_area |
170 | 26 | place | borough |
171 | 27 | place | suburb |
172 | 28 | place | croft |
173 | 29 | place | subdivision |
174 | 30 | place | isolated_dwelling |
175 | 31 | place | farm |
176 | 32 | place | locality |
177 | 33 | place | islet |
178 | 34 | place | mountain_pass |
179 | 35 | place | neighbourhood |
180 | 36 | place | house |
181 | 37 | place | building |
182 | 38 | place | houses |
183 And the named place nodes
184 | osm_id | class | type | extratags
185 | 100 | place | locality | 'locality' : 'townland'
186 | 101 | place | city | 'capital' : 'yes'
188 Then table placex contains
189 | object | rank_search | rank_address |
222 Scenario: search and address ranks for boundaries are correctly assigned
223 Given the named place nodes
224 | osm_id | class | type
225 | 1 | boundary | administrative
226 And the named place ways
227 | osm_id | class | type | geometry
228 | 10 | boundary | administrative | 10 10, 11 11
229 And the named place areas
230 | osm_type | osm_id | class | type | admin_level | geometry
231 | R | 20 | boundary | administrative | 2 | (1 1, 2 2, 1 2, 1 1)
232 | R | 21 | boundary | administrative | 32 | (3 3, 4 4, 3 4, 3 3)
233 | R | 22 | boundary | nature_park | 6 | (0 0, 1 0, 0 1, 0 0)
234 | R | 23 | boundary | natural_reserve| 10 | (0 0, 1 1, 1 0, 0 0)
236 Then table placex has no entry for N1
237 And table placex has no entry for W10
238 And table placex contains
239 | object | rank_search | rank_address
245 Scenario Outline: minor highways droped without name, included with
246 Given the scene roads-with-pois
249 | osm_id | class | type | geometry
250 | 1 | highway | <type> | :w-south
251 And the named place ways
252 | osm_id | class | type | geometry
253 | 2 | highway | <type> | :w-north
255 Then table placex has no entry for W1
256 And table placex contains
257 | object | rank_search | rank_address
258 | W2 | <rank> | <rank>
276 Scenario: search and address ranks for highways correctly assigned
277 Given the scene roads-with-pois
279 | osm_id | class | type
280 | 1 | highway | bus_stop
282 | osm_id | class | type | geometry
283 | 1 | highway | primary | :w-south
284 | 2 | highway | secondary | :w-south
285 | 3 | highway | tertiary | :w-south
286 | 4 | highway | residential | :w-north
287 | 5 | highway | unclassified | :w-north
288 | 6 | highway | something | :w-north
290 Then table placex contains
291 | object | rank_search | rank_address
300 Scenario: rank and inclusion of landuses
301 Given the place nodes
302 | osm_id | class | type
303 | 1 | landuse | residential
304 And the named place nodes
305 | osm_id | class | type
306 | 2 | landuse | residential
308 | osm_id | class | type | geometry
309 | 1 | landuse | residential | 0 0, 0 1
310 And the named place ways
311 | osm_id | class | type | geometry
312 | 2 | landuse | residential | 1 1, 1 1.1
314 | osm_type | osm_id | class | type | geometry
315 | W | 3 | landuse | residential | poly-area:0.1
316 | R | 1 | landuse | residential | poly-area:0.01
317 | R | 10 | landuse | residential | poly-area:0.5
318 And the named place areas
319 | osm_type | osm_id | class | type | geometry
320 | W | 4 | landuse | residential | poly-area:0.1
321 | R | 2 | landuse | residential | poly-area:0.05
322 | R | 3 | landuse | forrest | poly-area:0.5
324 Then table placex has no entry for N1
325 And table placex has no entry for W1
326 And table placex has no entry for W3
327 And table placex has no entry for R1
328 And table placex has no entry for R10
329 And table placex contains
330 | object | rank_search | rank_address
337 Scenario: rank and inclusion of naturals
338 Given the place nodes
339 | osm_id | class | type
341 | 3 | natural | volcano
342 And the named place nodes
343 | osm_id | class | type
345 | 4 | natural | volcano
346 | 5 | natural | foobar
348 | osm_id | class | type | geometry
349 | 1 | natural | mountain_range | 10 10,11 11
350 And the named place ways
351 | osm_id | class | type | geometry
352 | 2 | natural | mountain_range | 12 12,11 11
353 | 3 | natural | foobar | 13 13,13.1 13
354 | 4 | natural | coastline | 14 14,14.1 14
356 | osm_type | osm_id | class | type | geometry
357 | R | 1 | natural | volcano | poly-area:0.1
358 | R | 2 | natural | volcano | poly-area:1.0
359 And the named place areas
360 | osm_type | osm_id | class | type | geometry
361 | R | 3 | natural | volcano | poly-area:0.1
362 | R | 4 | natural | foobar | poly-area:0.5
363 | R | 5 | natural | sea | poly-area:5.0
364 | R | 6 | natural | sea | poly-area:0.01
365 | R | 7 | natural | coastline | poly-area:1.0
367 Then table placex has no entry for N1
368 And table placex has no entry for N3
369 And table placex has no entry for W1
370 And table placex has no entry for R1
371 And table placex has no entry for R2
372 And table placex has no entry for R7
373 And table placex has no entry for W4
374 And table placex contains
375 | object | rank_search | rank_address