2 Feature: Tag evaluation
3 Tests if tags are correctly imported into the place table
5 Scenario Outline: Name tags
8 | 1 | 'highway' : 'yes', '<nametag>' : 'Foo'
10 Then table place contains
12 | N1 | '<nametag>' : 'Foo'
49 Scenario Outline: operator only for shops and amenities
52 | 1 | 'highway' : 'yes', 'operator' : 'Foo', 'name' : 'null'
53 | 2 | 'shop' : 'grocery', 'operator' : 'Foo'
54 | 3 | 'amenity' : 'hospital', 'operator' : 'Foo'
55 | 4 | 'tourism' : 'hotel', 'operator' : 'Foo'
57 Then table place contains
59 | N1 | 'name' : 'null'
60 | N2 | 'operator' : 'Foo'
61 | N3 | 'operator' : 'Foo'
62 | N4 | 'operator' : 'Foo'
64 Scenario Outline: Ignored name tags
67 | 1 | 'highway' : 'yes', '<nametag>' : 'Foo', 'name' : 'real'
69 Then table place contains
71 | N1 | 'name' : 'real'
83 Scenario: Special character in name tag
86 | 1 | 'highway' : 'yes', 'name: de' : 'Foo', 'name' : 'real1'
87 | 2 | 'highway' : 'yes', 'name:
de' : 'Foo', 'name' : 'real2'
88 | 3 | 'highway' : 'yes', 'name:	de' : 'Foo', 'name:\\' : 'real3'
90 Then table place contains
92 | N1 | 'name: de' : 'Foo', 'name' : 'real1'
93 | N2 | 'name: de' : 'Foo', 'name' : 'real2'
94 | N3 | 'name: de' : 'Foo', 'name:\\\\' : 'real3'
96 Scenario Outline: Included places
99 | 1 | '<key>' : '<value>', 'name' : 'real'
100 When loading osm data
101 Then table place contains
103 | N1 | 'name' : 'real'
108 | tourism | information
110 | military | barracks
112 | highway | residential
113 | aerialway | station
115 | boundary | administrative
117 | leisure | playground
124 | mountain_pass | yes
126 Scenario Outline: Bridges and Tunnels take special name tags
129 | 1 | 'highway' : 'road', '<key>' : 'yes', 'name' : 'Rd', '<key>:name' : 'My'
130 | 2 | 'highway' : 'road', '<key>' : 'yes', 'name' : 'Rd'
131 When loading osm data
132 Then table place contains
133 | object | class | type | name
134 | N1:highway | highway | road | 'name' : 'Rd'
135 | N1:<key> | <key> | yes | 'name' : 'My'
136 | N2:highway | highway | road | 'name' : 'Rd'
137 And table place has no entry for N2:<key>
144 Scenario Outline: Excluded places
147 | 1 | '<key>' : '<value>', 'name' : 'real'
148 | 2 | 'highway' : 'motorway', 'name' : 'To Hell'
149 When loading osm data
150 Then table place has no entry for N1
165 | highway | turning_circle
166 | highway | mini_roundabout
171 | man_made | survey_point
180 | railway | level_crossing
183 | waterway | riverbank
185 Scenario: Some tags only are included when named
188 | 1 | '<key>' : '<value>'
189 | 2 | '<key>' : '<value>', 'name' : 'To Hell'
190 | 3 | '<key>' : '<value>', 'ref' : '123'
191 When loading osm data
192 Then table place has no entry for N1
193 And table place has no entry for N3
194 And table place contains
195 | object | class | type
196 | N2 | <key> | <value>
200 | landuse | residential
202 | highway | traffic_signals
208 | highway | bridleway
211 | highway | motorway_link
212 | highway | primary_link
213 | highway | trunk_link
214 | highway | secondary_link
215 | highway | tertiary_link
217 | boundary | administrative
220 Scenario: Footways are not included if they are sidewalks
223 | 2 | 'highway' : 'footway', 'name' : 'To Hell', 'footway' : 'sidewalk'
224 | 23 | 'highway' : 'footway', 'name' : 'x'
225 When loading osm data
226 Then table place has no entry for N2
228 Scenario: named junctions are included if there is no other tag
231 | 1 | 'junction' : 'yes'
232 | 2 | 'highway' : 'secondary', 'junction' : 'roundabout', 'name' : 'To Hell'
233 | 3 | 'junction' : 'yes', 'name' : 'Le Croix'
234 When loading osm data
235 Then table place has no entry for N1
236 And table place has no entry for N2:junction
237 And table place contains
238 | object | class | type
239 | N3 | junction | yes
241 Scenario: Boundary with place tag
250 | 2 | 'boundary' : 'administrative', 'place' : 'city', 'name' : 'Foo' | 200 201 202 203 200
251 | 4 | 'boundary' : 'administrative', 'place' : 'island','name' : 'Foo' | 200 201 202 203 200
252 | 20 | 'place' : 'city', 'name' : 'ngng' | 200 201 202 203 200
253 | 40 | 'place' : 'city', 'boundary' : 'statistical', 'name' : 'BB' | 200 201 202 203 200
254 When loading osm data
255 Then table place contains
256 | object | class | extratags | type
257 | W2 | boundary | 'place' : 'city' | administrative
258 | W4:boundary | boundary | None | administrative
259 | W4:place | place | None | island
260 | W20 | place | None | city
261 | W40:boundary | boundary | None | statistical
262 | W40:place | place | None | city
263 And table place has no entry for W2:place
265 Scenario Outline: Tags that describe a house
268 | 100 | '<key>' : '<value>'
269 | 999 | 'amenity' : 'prison', '<key>' : '<value>'
270 When loading osm data
271 Then table place contains
272 | object | class | type
273 | N100 | place | house
274 | N999 | amenity | prison
275 And table place has no entry for N100:<key>
276 And table place has no entry for N999:<key>
277 And table place has no entry for N999:place
281 | addr:housename | My Mansion
282 | addr:housenumber | 456
283 | addr:conscriptionnumber | 4
284 | addr:streetnumber | 4568765
286 Scenario: Only named with no other interesting tag
289 | 1 | 'landuse' : 'meadow'
290 | 2 | 'landuse' : 'residential', 'name' : 'important'
291 | 3 | 'landuse' : 'residential', 'name' : 'important', 'place' : 'hamlet'
292 When loading osm data
293 Then table place contains
294 | object | class | type
295 | N2 | landuse | residential
296 | N3 | place | hamlet
297 And table place has no entry for N1
298 And table place has no entry for N3:landuse
300 Scenario Outline: Import of postal codes
303 | 10 | 'highway' : 'secondary', '<key>' : '<value>'
304 | 11 | '<key>' : '<value>'
305 When loading osm data
306 Then table place contains
307 | object | class | type | postcode
308 | N10 | highway | secondary | <value>
309 | N11 | place | postcode | <value>
310 And table place has no entry for N10:place
314 | postal_code | 45736
316 | addr:postcode | 564
317 | tiger:zip_left | 00011
318 | tiger:zip_right | 09123
320 Scenario: Import of street and place
323 | 10 | 'amenity' : 'hospital', 'addr:street' : 'Foo St'
324 | 20 | 'amenity' : 'hospital', 'addr:place' : 'Foo Town'
325 When loading osm data
326 Then table place contains
327 | object | class | type | street | addr_place
328 | N10 | amenity | hospital | Foo St | None
329 | N20 | amenity | hospital | None | Foo Town
332 Scenario Outline: Import of country
335 | 10 | 'place' : 'village', '<key>' : '<value>'
336 When loading osm data
337 Then table place contains
338 | object | class | type | country_code
339 | N10 | place | village | <value>
345 | is_in:country_code | __
347 | addr:country_code | cv
349 Scenario Outline: Ignore country codes with wrong length
352 | 10 | 'place' : 'village', 'country_code' : '<value>'
353 When loading osm data
354 Then table place contains
355 | object | class | type | country_code
356 | N10 | place | village | None
366 Scenario: Import of house numbers
369 | 10 | 'building' : 'yes', 'addr:housenumber' : '4b'
370 | 11 | 'building' : 'yes', 'addr:conscriptionnumber' : '003'
371 | 12 | 'building' : 'yes', 'addr:streetnumber' : '2345'
372 | 13 | 'building' : 'yes', 'addr:conscriptionnumber' : '3', 'addr:streetnumber' : '111'
373 When loading osm data
374 Then table place contains
375 | object | class | type | housenumber
376 | N10 | building | yes | 4b
377 | N11 | building | yes | 003
378 | N12 | building | yes | 2345
379 | N13 | building | yes | 3/111
381 Scenario: Import of address interpolations
384 | 10 | 'addr:interpolation' : 'odd'
385 | 11 | 'addr:housenumber' : '10', 'addr:interpolation' : 'odd'
386 | 12 | 'addr:interpolation' : 'odd', 'addr:housenumber' : '23'
387 When loading osm data
388 Then table place contains
389 | object | class | type | housenumber
390 | N10 | place | houses | odd
391 | N11 | place | houses | odd
392 | N12 | place | houses | odd
394 Scenario: Shorten tiger:county tags
397 | 10 | 'place' : 'village', 'tiger:county' : 'Feebourgh, AL'
398 | 11 | 'place' : 'village', 'addr:state' : 'Alabama', 'tiger:county' : 'Feebourgh, AL'
399 | 12 | 'place' : 'village', 'tiger:county' : 'Feebourgh'
400 When loading osm data
401 Then table place contains
402 | object | class | type | isin
403 | N10 | place | village | Feebourgh county
404 | N11 | place | village | Feebourgh county,Alabama
405 | N12 | place | village | Feebourgh county
407 Scenario Outline: Import of address tags
410 | 10 | 'place' : 'village', '<key>' : '<value>'
411 When loading osm data
412 Then table place contains
413 | object | class | type | isin
414 | N10 | place | village | <value>
418 | is_in | Stockholm, Sweden
419 | is_in:country | Xanadu
420 | addr:suburb | hinein
421 | addr:county | le havre
425 Scenario: Import of admin level
428 | 10 | 'amenity' : 'hospital', 'admin_level' : '3'
429 | 11 | 'amenity' : 'hospital', 'admin_level' : 'b'
430 | 12 | 'amenity' : 'hospital'
431 | 13 | 'amenity' : 'hospital', 'admin_level' : '3.0'
432 When loading osm data
433 Then table place contains
434 | object | class | type | admin_level
435 | N10 | amenity | hospital | 3
436 | N11 | amenity | hospital | 100
437 | N12 | amenity | hospital | 100
438 | N13 | amenity | hospital | 3
440 Scenario: Import of extra tags
443 | 10 | 'tourism' : 'hotel', '<key>' : 'foo'
444 When loading osm data
445 Then table place contains
446 | object | class | type | extratags
447 | N10 | tourism | hotel | '<key>' : 'foo'
523 | 10 | 'tourism' : 'hotel', 'building' : 'yes'
524 | 11 | 'building' : 'house'
525 | 12 | 'building' : 'shed', 'addr:housenumber' : '1'
526 | 13 | 'building' : 'yes', 'name' : 'Das Haus'
527 | 14 | 'building' : 'yes', 'addr:postcode' : '12345'
528 When loading osm data
529 Then table place contains
530 | object | class | type
531 | N10 | tourism | hotel
532 | N12 | building| yes
533 | N13 | building| yes
534 | N14 | building| yes
535 And table place has no entry for N10:building
536 And table place has no entry for N11
538 Scenario: complete node entry
541 | 290393920 | 'addr:city':'Perpignan','addr:country':'FR','addr:housenumber':'43\\','addr:postcode':'66000','addr:street':'Rue Pierre Constant d`Ivry','source':'cadastre-dgi-fr source : Direction Générale des Impôts - Cadastre ; mise à jour :2008'
542 When loading osm data
543 Then table place contains
544 | object | class | type | housenumber
545 | N290393920 | place | house| 43\