]> git.openstreetmap.org Git - nominatim.git/blob - test/bdd/osm2pgsql/import/tags.feature
Merge pull request #977 from lonvia/fix-byteswap-check
[nominatim.git] / test / bdd / osm2pgsql / import / tags.feature
1 @DB
2 Feature: Tag evaluation
3     Tests if tags are correctly imported into the place table
4
5     Scenario Outline: Name tags
6        When loading osm data
7          """
8          n1 Thighway=yes,<nametag>=Foo
9          """
10        Then place contains
11          | object | name |
12          | N1     | '<nametag>' : 'Foo' |
13
14     Examples:
15      | nametag |
16      | ref |
17      | int_ref |
18      | nat_ref |
19      | reg_ref |
20      | loc_ref |
21      | old_ref |
22      | iata |
23      | icao |
24      | pcode:1 |
25      | pcode:2 |
26      | pcode:3 |
27      | name |
28      | name:de |
29      | name:bt-BR |
30      | int_name |
31      | int_name:xxx |
32      | nat_name |
33      | nat_name:fr |
34      | reg_name |
35      | reg_name:1 |
36      | loc_name |
37      | loc_name:DE |
38      | old_name |
39      | old_name:v1 |
40      | alt_name |
41      | alt_name:dfe |
42      | alt_name_1 |
43      | official_name |
44      | short_name |
45      | short_name:CH |
46      | addr:housename |
47      | brand |
48
49     Scenario: operator only for shops and amenities
50         When loading osm data
51          """
52          n1 Thighway=yes,operator=Foo,name=null
53          n2 Tshop=grocery,operator=Foo
54          n3 Tamenity=hospital,operator=Foo
55          n4 Ttourism=hotel,operator=Foo
56          """
57         Then place contains
58          | object | name |
59          | N1     | 'name' : 'null' |
60          | N2     | 'operator' : 'Foo' |
61          | N3     | 'operator' : 'Foo' |
62          | N4     | 'operator' : 'Foo' |
63
64     Scenario Outline: Ignored name tags
65         When loading osm data
66          """
67          n1 Thighway=yes,<nametag>=Foo,name=real
68          """
69         Then place contains
70          | object | name |
71          | N1     | 'name' : 'real' |
72
73     Examples:
74      | nametag |
75      | name_de |
76      | Name |
77      | ref:de |
78      | ref_de |
79      | my:ref |
80      | br:name |
81      | name:prefix |
82      | name:source |
83
84     Scenario: Special character in name tag
85         When loading osm data
86          """
87          n1 Thighway=yes,name:%20%de=Foo,name=real1
88          n2 Thighway=yes,name:%a%de=Foo,name=real2
89          n3 Thighway=yes,name:%9%de=Foo,name:\\=real3
90          n4 Thighway=yes,name:%9%de=Foo,name=rea\l3
91          """
92         Then place contains
93          | object | name |
94          | N1     | 'name: de' : 'Foo', 'name' : 'real1' |
95          | N2     | 'name: de' : 'Foo', 'name' : 'real2' |
96          | N3     | 'name: de' : 'Foo', 'name:\\\\' : 'real3' |
97          | N4     | 'name: de' : 'Foo', 'name' : 'rea\\l3' |
98
99     Scenario: Unprintable character in address tag are maintained
100         When loading osm data
101          """
102          n23 Tamenity=yes,name=foo,addr:postcode=1234%200e%
103          """
104         Then place contains
105          | object | address |
106          | N23    | 'postcode' : u'1234\u200e' |
107
108     Scenario Outline: Included places
109         When loading osm data
110          """
111          n1 T<key>=<value>,name=real
112          """
113         Then place contains
114          | object | class | type    | name |
115          | N1     | <key> | <value> | 'name' : 'real' |
116
117     Examples:
118      | key       | value |
119      | emergency | phone |
120      | tourism   | information |
121      | historic  | castle |
122      | military  | barracks |
123      | natural   | water |
124      | highway   | residential |
125      | aerialway | station |
126      | aeroway   | way |
127      | boundary  | administrative |
128      | craft     | butcher |
129      | leisure   | playground |
130      | office    | bookmaker |
131      | railway   | rail |
132      | shop      | bookshop |
133      | waterway  | stream |
134      | landuse   | cemetry |
135      | man_made  | tower |
136      | mountain_pass | yes |
137
138     Scenario Outline: Bridges and Tunnels take special name tags
139         When loading osm data
140          """
141          n1 Thighway=road,<key>=yes,name=Rd,<key>:name=My
142          n2 Thighway=road,<key>=yes,name=Rd
143          """
144         Then place contains
145           | object     | type | name |
146           | N1:highway | road | 'name' : 'Rd' |
147           | N1:<key>   | yes  | 'name' : 'My' |
148           | N2:highway | road | 'name' : 'Rd' |
149         And place has no entry for N2:<key>
150
151     Examples:
152       | key |
153       | bridge |
154       | tunnel |
155
156     Scenario Outline: Excluded places
157         When loading osm data
158          """
159          n1 T<key>=<value>,name=real
160          n2 Thighway=motorway,name=To%20%Hell
161          """
162         Then place has no entry for N1
163
164     Examples:
165      | key       | value |
166      | emergency | yes |
167      | emergency | no |
168      | tourism   | yes |
169      | tourism   | no |
170      | historic  | yes |
171      | historic  | no |
172      | military  | yes |
173      | military  | no |
174      | natural   | yes |
175      | natural   | no |
176      | highway   | no |
177      | highway   | turning_circle |
178      | highway   | mini_roundabout |
179      | highway   | noexit |
180      | highway   | crossing |
181      | aerialway | no |
182      | aerialway | pylon |
183      | man_made  | survey_point |
184      | man_made  | cutline |
185      | aeroway   | no |
186      | amenity   | no |
187      | bridge    | no |
188      | craft     | no |
189      | leisure   | no |
190      | office    | no |
191      | railway   | no |
192      | railway   | level_crossing |
193      | shop      | no |
194      | tunnel    | no |
195      | waterway  | riverbank |
196
197     Scenario Outline: Some tags only are included when named
198         When loading osm data
199         """
200         n1 T<key>=<value>
201         n2 T<key>=<value>,name=To%20%Hell
202         n3 T<key>=<value>,ref=123
203         """
204         Then place contains exactly
205          | object | class | type |
206          | N2     | <key> | <value> |
207
208     Examples:
209       | key      | value |
210       | landuse  | residential |
211       | natural  | meadow |
212       | highway  | traffic_signals |
213       | highway  | service |
214       | highway  | cycleway |
215       | highway  | path |
216       | highway  | footway |
217       | highway  | steps |
218       | highway  | bridleway |
219       | highway  | track |
220       | highway  | byway |
221       | highway  | motorway_link |
222       | highway  | primary_link |
223       | highway  | trunk_link |
224       | highway  | secondary_link |
225       | highway  | tertiary_link |
226       | railway  | rail |
227       | boundary | administrative |
228       | waterway | stream |
229
230     Scenario: Footways are not included if they are sidewalks
231         When loading osm data
232           """
233           n2 Thighway=footway,name=To%20%Hell,footway=sidewalk
234           n23 Thighway=footway,name=x
235           """
236         Then place has no entry for N2
237
238     Scenario: named junctions are included if there is no other tag
239         When loading osm data
240           """
241           n1 Tjunction=yes
242           n2 Thighway=secondary,junction=roundabout,name=To-Hell
243           n3 Tjunction=yes,name=Le%20%Croix
244           """
245         Then place has no entry for N1
246         And place has no entry for N2:junction
247         And place contains
248          | object | class    | type |
249          | N3     | junction | yes |
250
251     Scenario: Boundary with place tag
252         When loading osm data
253           """
254           n200 x0 y0
255           n201 x0 y1
256           n202 x1 y1
257           n203 x1 y0
258           w2 Tboundary=administrative,place=city,name=Foo Nn200,n201,n202,n203,n200
259           w4 Tboundary=administrative,place=island,name=Foo Nn200,n201,n202,n203,n200
260           w20 Tplace=city,name=ngng Nn200,n201,n202,n203,n200
261           w40 Tplace=city,boundary=statistical,name=BB Nn200,n201,n202,n203,n200
262           """
263         Then place contains
264           | object       | class    | extratags        | type |
265           | W2           | boundary | 'place' : 'city' | administrative |
266           | W4:boundary  | boundary | -                | administrative |
267           | W4:place     | place    | -                | island |
268           | W20          | place    | -                | city |
269           | W40:boundary | boundary | -                | statistical |
270           | W40:place    | place    | -                | city |
271         And place has no entry for W2:place
272
273     Scenario Outline: Tags that describe a house
274         When loading osm data
275           """
276           n100 T<key>=<value>
277           n999 Tamenity=prison,<key>=<value>
278           """
279         Then place contains exactly
280           | object | class   | type |
281           | N100   | place   | house |
282           | N999   | amenity | prison |
283
284     Examples:
285       | key                     | value |
286       | addr:housename          | My%20%Mansion |
287       | addr:housenumber        | 456 |
288       | addr:conscriptionnumber | 4 |
289       | addr:streetnumber       | 4568765 |
290
291     Scenario: Only named with no other interesting tag
292         When loading osm data
293           """
294           n1 Tlanduse=meadow
295           n2 Tlanduse=residential,name=important
296           n3 Tlanduse=residential,name=important,place=hamlet
297           """
298         Then place contains
299           | object | class   | type |
300           | N2     | landuse | residential |
301           | N3     | place   | hamlet |
302         And place has no entry for N1
303         And place has no entry for N3:landuse
304
305     Scenario Outline: Import of postal codes
306         When loading osm data
307           """
308           n10 Thighway=secondary,<key>=<value>
309           n11 T<key>=<value>
310           """
311         Then place contains
312           | object | class   | type      | addr+postcode |
313           | N10    | highway | secondary | <value> |
314           | N11    | place   | postcode  | <value> |
315         And place has no entry for N10:place
316
317     Examples:
318       | key                 | value |
319       | postal_code         | 45736 |
320       | postcode            | xxx |
321       | addr:postcode    | 564 |
322       | tiger:zip_left   | 00011 |
323       | tiger:zip_right  | 09123 |
324
325     Scenario: Import of street and place
326         When loading osm data
327           """
328           n10 Tamenity=hospital,addr:street=Foo%20%St
329           n20 Tamenity=hospital,addr:place=Foo%20%Town
330           """
331         Then place contains
332           | object | class   | type     | addr+street | addr+place |
333           | N10    | amenity | hospital | Foo St      | -        |
334           | N20    | amenity | hospital | -           | Foo Town |
335
336
337     Scenario Outline: Import of country
338         When loading osm data
339           """
340           n10 Tplace=village,<key>=<value>
341           """
342         Then place contains
343           | object | class   | type    | addr+country |
344           | N10    | place   | village | <value> |
345
346     Examples:
347         | key                  | value |
348         | country_code         | us |
349         | ISO3166-1            | XX |
350         | is_in:country_code   | __ |
351         | addr:country         | .. |
352         | addr:country_code    | cv |
353
354     Scenario Outline: Ignore country codes with wrong length
355         When loading osm data
356           """
357           n10 Tplace=village,country_code=<value>
358           """
359         Then place contains
360           | object | class   | type    | addr+country |
361           | N10    | place   | village | - |
362
363     Examples:
364         | value |
365         | X |
366         | x |
367         | ger |
368         | dkeufr |
369         | d%20%e |
370
371     Scenario: Import of house numbers
372         When loading osm data
373           """
374           n10 Tbuilding=yes,addr:housenumber=4b
375           n11 Tbuilding=yes,addr:conscriptionnumber=003
376           n12 Tbuilding=yes,addr:streetnumber=2345
377           n13 Tbuilding=yes,addr:conscriptionnumber=3,addr:streetnumber=111
378           """
379         Then place contains
380           | object | class | type    | address |
381           | N10    | building | yes  | 'housenumber' : '4b' |
382           | N11    | building | yes  | 'conscriptionnumber' : '003' |
383           | N12    | building | yes  | 'streetnumber' : '2345' |
384           | N13    | building | yes  | 'conscriptionnumber' : '3', 'streetnumber' : '111' |
385
386     Scenario: Shorten tiger:county tags
387         When loading osm data
388           """
389           n10 Tplace=village,tiger:county=Feebourgh%2c%%20%AL
390           n11 Tplace=village,addr:state=Alabama,tiger:county=Feebourgh%2c%%20%AL
391           n12 Tplace=village,tiger:county=Feebourgh
392           """
393         Then place contains
394           | object | class   | type    | addr+tiger:county |
395           | N10    | place   | village | Feebourgh county |
396           | N11    | place   | village | Feebourgh county |
397           | N12    | place   | village | Feebourgh county |
398
399     Scenario Outline: Import of address tags
400         When loading osm data
401           """
402           n10 Tplace=village,addr:<key>=<value>
403           n11 Tplace=village,is_in:<key>=<value>
404           """
405         Then place contains
406           | object | class   | type    | address |
407           | N10    | place   | village | '<key>' : '<value>' |
408
409     Examples:
410       | key       | value |
411       | suburb    | hinein |
412       | city      | Sydney |
413       | state     | Jura |
414
415     Scenario: Import of isin tags with space
416         When loading osm data
417           """
418           n10 Tplace=village,is_in=Stockholm%2c%%20%Sweden
419           n11 Tplace=village,addr:county=le%20%havre
420           """
421         Then place contains
422           | object | class   | type    | address |
423           | N10    | place   | village | 'is_in' : 'Stockholm, Sweden' |
424           | N11    | place   | village | 'county' : 'le havre' |
425
426     Scenario: Import of admin level
427         When loading osm data
428           """
429           n10 Tamenity=hospital,admin_level=3
430           n11 Tamenity=hospital,admin_level=b
431           n12 Tamenity=hospital
432           n13 Tamenity=hospital,admin_level=3.0
433           """
434         Then place contains
435           | object | class   | type     | admin_level |
436           | N10    | amenity | hospital | 3 |
437           | N11    | amenity | hospital | 15 |
438           | N12    | amenity | hospital | 15 |
439           | N13    | amenity | hospital | 3 |
440
441     Scenario Outline: Import of extra tags
442         When loading osm data
443           """
444           n10 Ttourism=hotel,<key>=foo
445           """
446         Then place contains
447           | object | class   | type  | extratags |
448           | N10    | tourism | hotel | '<key>' : 'foo' |
449
450      Examples:
451        | key |
452        | tracktype |
453        | traffic_calming |
454        | service |
455        | cuisine |
456        | capital |
457        | dispensing |
458        | religion |
459        | denomination |
460        | sport |
461        | internet_access |
462        | lanes |
463        | surface |
464        | smoothness |
465        | width |
466        | est_width |
467        | incline |
468        | opening_hours |
469        | collection_times |
470        | service_times |
471        | disused |
472        | wheelchair |
473        | sac_scale |
474        | trail_visibility |
475        | mtb:scale |
476        | mtb:description |
477        | wood |
478        | drive_in |
479        | access |
480        | vehicle |
481        | bicyle |
482        | foot |
483        | goods |
484        | hgv |
485        | motor_vehicle |
486        | motor_car |
487        | access:foot |
488        | contact:phone |
489        | drink:mate |
490        | oneway |
491        | date_on |
492        | date_off |
493        | day_on |
494        | day_off |
495        | hour_on |
496        | hour_off |
497        | maxweight |
498        | maxheight |
499        | maxspeed |
500        | disused |
501        | toll |
502        | charge |
503        | population |
504        | description |
505        | image |
506        | attribution |
507        | fax |
508        | email |
509        | url |
510        | website |
511        | phone |
512        | real_ale |
513        | smoking |
514        | food |
515        | camera |
516        | brewery |
517        | locality |
518        | wikipedia |
519        | wikipedia:de |
520        | wikidata |
521        | name:prefix |
522        | name:botanical |
523        | name:etymology:wikidata |
524
525     Scenario: buildings
526         When loading osm data
527           """
528           n10 Ttourism=hotel,building=yes
529           n11 Tbuilding=house
530           n12 Tbuilding=shed,addr:housenumber=1
531           n13 Tbuilding=yes,name=Das-Haus
532           n14 Tbuilding=yes,addr:postcode=12345
533           """
534         Then place contains
535           | object | class   | type |
536           | N10    | tourism | hotel |
537           | N12    | building| yes |
538           | N13    | building| yes |
539           | N14    | building| yes |
540         And place has no entry for N10:building
541         And place has no entry for N11
542
543     Scenario: complete node entry
544         When loading osm data
545           """
546           n290393920 Taddr:city=Perpignan,addr:country=FR,addr:housenumber=43\,addr:postcode=66000,addr:street=Rue%20%Pierre%20%Constant%20%d`Ivry,source=cadastre-dgi-fr%20%source%20%:%20%Direction%20%Générale%20%des%20%Impôts%20%-%20%Cadastre%20%;%20%mise%20%à%20%jour%20%:2008
547           """
548         Then place contains
549          | object     | class   | type | address |
550          | N290393920 | place   | house| 'city' : 'Perpignan', 'country' : 'FR', 'housenumber' : '43\\', 'postcode' : '66000', 'street' : 'Rue Pierre Constant d`Ivry' |