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