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