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