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