]> git.openstreetmap.org Git - nominatim.git/blob - tests/features/osm2pgsql/import/tags.feature
make path to wikipedia files configurable
[nominatim.git] / tests / features / 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         Given the osm nodes:
7          | id | tags
8          | 1  | 'highway' : 'yes', '<nametag>' : 'Foo'
9         When loading osm data
10         Then table 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 Outline: operator only for shops and amenities
50         Given the osm nodes:
51          | id | tags
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'
56         When loading osm data
57         Then table 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         Given the osm nodes:
66          | id | tags
67          | 1  | 'highway' : 'yes', '<nametag>' : 'Foo', 'name' : 'real'
68         When loading osm data
69         Then table 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         Given the osm nodes:
86          | id | tags
87          | 1  | 'highway' : 'yes', 'name: de' : 'Foo', 'name' : 'real1'
88          | 2  | 'highway' : 'yes', 'name:&#xa;de' : 'Foo', 'name' : 'real2'
89          | 3  | 'highway' : 'yes', 'name:&#x9;de' : 'Foo', 'name:\\' : 'real3'
90         When loading osm data
91         Then table 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         Given the osm nodes:
99          | id | tags
100          | 1  | '<key>' : '<value>', 'name' : 'real'
101         When loading osm data
102         Then table 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         Given the osm nodes:
129           | id | tags
130           | 1  | 'highway' : 'road', '<key>' : 'yes', 'name' : 'Rd', '<key>:name' : 'My'
131           | 2  | 'highway' : 'road', '<key>' : 'yes', 'name' : 'Rd'
132         When loading osm data
133         Then table place contains
134           | object     | class   | type | name
135           | N1:highway | highway | road | 'name' : 'Rd'
136           | N1:<key>   | <key>   | yes  | 'name' : 'My'
137           | N2:highway | highway | road | 'name' : 'Rd'
138         And table place has no entry for N2:<key>
139
140     Examples:
141       | key
142       | bridge
143       | tunnel
144
145     Scenario Outline: Excluded places
146         Given the osm nodes:
147          | id | tags
148          | 1  | '<key>' : '<value>', 'name' : 'real'
149          | 2  | 'highway' : 'motorway', 'name' : 'To Hell'
150         When loading osm data
151         Then table 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: Some tags only are included when named
187         Given the osm nodes:
188          | id | tags
189          | 1  | '<key>' : '<value>'
190          | 2  | '<key>' : '<value>', 'name' : 'To Hell'
191          | 3  | '<key>' : '<value>', 'ref' : '123'
192         When loading osm data
193         Then table place has no entry for N1
194         And table place has no entry for N3
195         And table place contains
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         Given the osm nodes:
223          | id | tags
224          | 2  | 'highway' : 'footway', 'name' : 'To Hell', 'footway' : 'sidewalk'
225          | 23 | 'highway' : 'footway', 'name' : 'x'
226         When loading osm data
227         Then table place has no entry for N2
228
229     Scenario: named junctions are included if there is no other tag
230         Given the osm nodes:
231          | id | tags
232          | 1  | 'junction' : 'yes'
233          | 2  | 'highway' : 'secondary', 'junction' : 'roundabout', 'name' : 'To Hell'
234          | 3  | 'junction' : 'yes', 'name' : 'Le Croix'
235         When loading osm data
236         Then table place has no entry for N1
237         And table place has no entry for N2:junction
238         And table place contains
239          | object | class    | type
240          | N3     | junction | yes
241
242     Scenario: Boundary with place tag
243         Given the osm nodes:
244           | id  | geometry
245           | 200 | 0 0
246           | 201 | 0 1
247           | 202 | 1 1
248           | 203 | 1 0
249         And the osm ways:
250           | id | tags                                                              | nodes
251           | 2  | 'boundary' : 'administrative', 'place' : 'city', 'name' : 'Foo'   | 200 201 202 203 200
252           | 4  | 'boundary' : 'administrative', 'place' : 'island','name' : 'Foo'  | 200 201 202 203 200
253           | 20 | 'place' : 'city', 'name' : 'ngng'                                 | 200 201 202 203 200
254           | 40 | 'place' : 'city', 'boundary' : 'statistical', 'name' : 'BB'       | 200 201 202 203 200
255         When loading osm data
256         Then table place contains
257           | object       | class    | extratags        | type
258           | W2           | boundary | 'place' : 'city' | administrative
259           | W4:boundary  | boundary | None             | administrative
260           | W4:place     | place    | None             | island
261           | W20          | place    | None             | city
262           | W40:boundary | boundary | None             | statistical
263           | W40:place    | place    | None             | city
264         And table place has no entry for W2:place
265
266     Scenario Outline: Tags that describe a house
267         Given the osm nodes:
268           | id  | tags
269           | 100 | '<key>' : '<value>'
270           | 999 | 'amenity' : 'prison', '<key>' : '<value>'
271         When loading osm data
272         Then table place contains
273           | object | class   | type
274           | N100   | place   | house
275           | N999   | amenity | prison
276         And table place has no entry for N100:<key>
277         And table place has no entry for N999:<key>
278         And table place has no entry for N999:place
279
280     Examples:
281       | key                     | value
282       | addr:housename          | My Mansion
283       | addr:housenumber        | 456
284       | addr:conscriptionnumber | 4
285       | addr:streetnumber       | 4568765
286
287     Scenario: Only named with no other interesting tag
288         Given the osm nodes:
289           | id  | tags
290           | 1   | 'landuse' : 'meadow'
291           | 2   | 'landuse' : 'residential', 'name' : 'important'
292           | 3   | 'landuse' : 'residential', 'name' : 'important', 'place' : 'hamlet'
293         When loading osm data
294         Then table place contains
295           | object | class   | type
296           | N2     | landuse | residential
297           | N3     | place   | hamlet
298         And table place has no entry for N1
299         And table place has no entry for N3:landuse
300
301     Scenario Outline: Import of postal codes
302         Given the osm nodes:
303           | id  | tags
304           | 10  | 'highway' : 'secondary', '<key>' : '<value>'
305           | 11  | '<key>' : '<value>'
306         When loading osm data
307         Then table place contains
308           | object | class   | type      | postcode
309           | N10    | highway | secondary | <value>
310           | N11    | place   | postcode  | <value>
311         And table 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         Given the osm nodes:
323           | id  | tags
324           | 10  | 'amenity' : 'hospital', 'addr:street' : 'Foo St'
325           | 20  | 'amenity' : 'hospital', 'addr:place' : 'Foo Town'
326         When loading osm data
327         Then table place contains
328           | object | class   | type     | street  | addr_place
329           | N10    | amenity | hospital | Foo St  | None
330           | N20    | amenity | hospital | None    | Foo Town
331
332
333     Scenario Outline: Import of country
334         Given the osm nodes:
335           | id  | tags
336           | 10  | 'place' : 'village', '<key>' : '<value>'
337         When loading osm data
338         Then table place contains
339           | object | class   | type    | country_code
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         Given the osm nodes:
352           | id  | tags
353           | 10  | 'place' : 'village', 'country_code' : '<value>'
354         When loading osm data
355         Then table place contains
356           | object | class   | type    | country_code
357           | N10    | place   | village | None
358
359     Examples:
360         | value
361         | X
362         | x
363         | ger
364         | dkeufr
365         | d e
366
367     Scenario: Import of house numbers
368         Given the osm nodes:
369           | id  | tags
370           | 10  | 'building' : 'yes', 'addr:housenumber' : '4b'
371           | 11  | 'building' : 'yes', 'addr:conscriptionnumber' : '003'
372           | 12  | 'building' : 'yes', 'addr:streetnumber' : '2345'
373           | 13  | 'building' : 'yes', 'addr:conscriptionnumber' : '3', 'addr:streetnumber' : '111'
374         When loading osm data
375         Then table place contains
376           | object | class | type   | housenumber
377           | N10    | building | yes  | 4b
378           | N11    | building | yes  | 003
379           | N12    | building | yes  | 2345
380           | N13    | building | yes  | 3/111
381
382     Scenario: Import of address interpolations
383         Given the osm nodes:
384           | id  | tags
385           | 10  | 'addr:interpolation' : 'odd'
386           | 11  | 'addr:housenumber' : '10', 'addr:interpolation' : 'odd'
387           | 12  | 'addr:interpolation' : 'odd', 'addr:housenumber' : '23'
388         When loading osm data
389         Then table place contains
390           | object | class   | type    | housenumber
391           | N10    | place   | houses  | odd
392           | N11    | place   | houses  | odd
393           | N12    | place   | houses  | odd
394
395     Scenario: Shorten tiger:county tags
396         Given the osm nodes:
397           | id  | tags
398           | 10  | 'place' : 'village', 'tiger:county' : 'Feebourgh, AL'
399           | 11  | 'place' : 'village', 'addr:state' : 'Alabama', 'tiger:county' : 'Feebourgh, AL'
400           | 12  | 'place' : 'village', 'tiger:county' : 'Feebourgh'
401         When loading osm data
402         Then table place contains
403           | object | class   | type    | isin
404           | N10    | place   | village | Feebourgh county
405           | N11    | place   | village | Feebourgh county,Alabama
406           | N12    | place   | village | Feebourgh county
407
408     Scenario Outline: Import of address tags
409         Given the osm nodes:
410           | id  | tags
411           | 10  | 'place' : 'village', '<key>' : '<value>'
412         When loading osm data
413         Then table place contains
414           | object | class   | type    | isin
415           | N10    | place   | village | <value>
416
417     Examples:
418       | key             | value
419       | is_in           | Stockholm, Sweden
420       | is_in:country   | Xanadu
421       | addr:suburb     | hinein
422       | addr:county     | le havre
423       | addr:city       | Sydney
424       | addr:state      | Jura
425
426     Scenario: Import of admin level
427         Given the osm nodes:
428           | id  | tags
429           | 10  | 'amenity' : 'hospital', 'admin_level' : '3'
430           | 11  | 'amenity' : 'hospital', 'admin_level' : 'b'
431           | 12  | 'amenity' : 'hospital'
432           | 13  | 'amenity' : 'hospital', 'admin_level' : '3.0'
433         When loading osm data
434         Then table place contains
435           | object | class   | type     | admin_level
436           | N10    | amenity | hospital | 3
437           | N11    | amenity | hospital | 100
438           | N12    | amenity | hospital | 100
439           | N13    | amenity | hospital | 3
440
441     Scenario: Import of extra tags
442         Given the osm nodes:
443           | id  | tags
444           | 10  | 'tourism' : 'hotel', '<key>' : 'foo'
445         When loading osm data
446         Then table 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         Given the osm nodes:
527           | id  | tags
528           | 10  | 'tourism' : 'hotel', 'building' : 'yes'
529           | 11  | 'building' : 'house'
530           | 12  | 'building' : 'shed', 'addr:housenumber' : '1'
531           | 13  | 'building' : 'yes', 'name' : 'Das Haus'
532           | 14  | 'building' : 'yes', 'addr:postcode' : '12345'
533         When loading osm data
534         Then table place contains
535           | object | class   | type
536           | N10    | tourism | hotel
537           | N12    | building| yes
538           | N13    | building| yes
539           | N14    | building| yes
540         And table place has no entry for N10:building
541         And table place has no entry for N11
542
543    Scenario: complete node entry
544        Given the osm nodes:
545          | id        | tags
546          | 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'
547         When loading osm data
548         Then table place contains
549          | object     | class   | type | housenumber
550          | N290393920 | place   | house| 43\