]> git.openstreetmap.org Git - nominatim.git/blob - tests/features/osm2pgsql/import/tags.feature
switch to enhanced osm2pgsql C++ version
[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' : 'real'
87          | 2  | 'highway' : 'yes', 'name:\nde' : 'Foo', 'name' : 'real'
88          | 3  | 'highway' : 'yes', 'name:\tde' : 'Foo', 'name:\\' : 'real'
89         When loading osm data
90         Then table place contains
91          | object | name
92          | N1     | 'name:_de' : 'Foo', 'name' : 'real'
93          | N2     | 'name:_de' : 'Foo', 'name' : 'real'
94          | N3     | 'name:_de' : 'Foo', 'name:\\\\' : 'real'
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  | footway
205       | highway  | steps
206       | highway  | motorway_link
207       | highway  | tertiary_link
208       | railway  | rail
209       | boundary | administrative
210       | waterway | stream
211
212     Scenario: named junctions are included if there is no other tag
213         Given the osm nodes:
214          | id | tags
215          | 1  | 'junction' : 'yes'
216          | 2  | 'highway' : 'secondary', 'junction' : 'roundabout', 'name' : 'To Hell'
217          | 3  | 'junction' : 'yes', 'name' : 'Le Croix'
218         When loading osm data
219         Then table place has no entry for N1
220         And table place has no entry for N2:junction
221         And table place contains
222          | object | class    | type
223          | N3     | junction | yes
224
225     Scenario: Boundary with place tag
226         Given the osm nodes:
227           | id  | geometry
228           | 200 | 0 0
229           | 201 | 0 1
230           | 202 | 1 1
231           | 203 | 1 0
232         And the osm ways:
233           | id | tags                                                              | nodes
234           | 2  | 'boundary' : 'administrative', 'place' : 'city', 'name' : 'Foo'   | 200 201 202 203 200
235           | 4  | 'boundary' : 'administrative', 'place' : 'island','name' : 'Foo'  | 200 201 202 203 200
236           | 20 | 'place' : 'city', 'name' : 'ngng'                                 | 200 201 202 203 200
237           | 40 | 'place' : 'city', 'boundary' : 'statistical', 'name' : 'BB'       | 200 201 202 203 200
238         When loading osm data
239         Then table place contains
240           | object       | class    | type           | extratags
241           | W2           | boundary | administrative | 'place' : 'city'
242           | W4:boundary  | boundary | administrative |
243           | W4:place     | place    | island         |
244           | W20          | place    | city           |
245           | W40:boundary | boundary | statistical    |
246           | W40:place    | place    | city           |
247         And table place has no entry for W2:place
248
249     Scenario Outline: Tags that describe a house
250         Given the osm nodes:
251           | id  | tags
252           | 100 | '<key>' : '<value>'
253           | 999 | 'amenity' : 'prison', '<key>' : '<value>'
254         When loading osm data
255         Then table place contains
256           | object | class   | type
257           | N100   | place   | house
258           | N999   | amenity | prison
259         And table place has no entry for N100:<key>
260         And table place has no entry for N999:<key>
261         And table place has no entry for N999:place
262
263     Examples:
264       | key                     | value
265       | addr:housename          | My Mansion
266       | addr:housenumber        | 456
267       | addr:conscriptionnumber | 4
268       | addr:streetnumber       | 4568765
269
270     Scenario: Only named with no other interesting tag
271         Given the osm nodes:
272           | id  | tags
273           | 1   | 'landuse' : 'meadow'
274           | 2   | 'landuse' : 'residential', 'name' : 'important'
275           | 3   | 'landuse' : 'residential', 'name' : 'important', 'place' : 'hamlet'
276         When loading osm data
277         Then table place contains
278           | object | class   | type
279           | N2     | landuse | residential
280           | N3     | place   | hamlet
281         And table place has no entry for N1
282         And table place has no entry for N3:landuse
283
284     Scenario Outline: Import of postal codes
285         Given the osm nodes:
286           | id  | tags
287           | 10  | 'highway' : 'secondary', '<key>' : '<value>'
288           | 11  | '<key>' : '<value>'
289         When loading osm data
290         Then table place contains
291           | object | class   | type      | postcode
292           | N10    | highway | secondary | <value>
293           | N11    | place   | postcode  | <value>
294         And table place has no entry for N10:place
295
296     Examples:
297       | key              | value
298       | postal_code      | 45736
299       | postcode         | xxx
300       | addr:postcode    | 564
301       | tiger:zip_left   | 00011
302       | tiger:zip_right  | 09123
303
304     Scenario: Import of street and place
305         Given the osm nodes:
306           | id  | tags
307           | 10  | 'amenity' : 'hospital', 'addr:street' : 'Foo St'
308           | 20  | 'amenity' : 'hospital', 'addr:place' : 'Foo Town'
309         When loading osm data
310         Then table place contains
311           | object | class   | type     | street  | addr_place
312           | N10    | amenity | hospital | Foo St  | None
313           | N20    | amenity | hospital | None    | Foo Town
314
315
316     Scenario Outline: Import of country
317         Given the osm nodes:
318           | id  | tags
319           | 10  | 'place' : 'village', '<key>' : '<value>'
320         When loading osm data
321         Then table place contains
322           | object | class   | type    | country_code
323           | N10    | place   | village | <value>
324
325     Examples:
326         | key                            | value
327         | country_code                   | us
328         | ISO3166-1                      | XX
329         | is_in:country_code             | __
330         | addr:country                   | ..
331         | addr:country_code              | cv
332
333     Scenario Outline: Ignore country codes with wrong length
334         Given the osm nodes:
335           | id  | tags
336           | 10  | 'place' : 'village', 'country_code' : '<value>'
337         When loading osm data
338         Then table place contains
339           | object | class   | type    | country_code
340           | N10    | place   | village | None
341
342     Examples:
343         | value
344         | X
345         | x
346         | ger
347         | dkeufr
348         | d e
349
350     Scenario: Import of house numbers
351         Given the osm nodes:
352           | id  | tags
353           | 10  | 'building' : 'yes', 'addr:housenumber' : '4b'
354           | 11  | 'building' : 'yes', 'addr:conscriptionnumber' : '003'
355           | 12  | 'building' : 'yes', 'addr:streetnumber' : '2345'
356           | 13  | 'building' : 'yes', 'addr:conscriptionnumber' : '3', 'addr:streetnumber' : '111'
357         When loading osm data
358         Then table place contains
359           | object | class | type   | housenumber
360           | N10    | building | yes  | 4b
361           | N11    | building | yes  | 003
362           | N12    | building | yes  | 2345
363           | N13    | building | yes  | 3/111
364
365     Scenario: Import of address interpolations
366         Given the osm nodes:
367           | id  | tags
368           | 10  | 'addr:interpolation' : 'odd'
369           | 11  | 'addr:housenumber' : '10', 'addr:interpolation' : 'odd'
370           | 12  | 'addr:interpolation' : 'odd', 'addr:housenumber' : '23'
371         When loading osm data
372         Then table place contains
373           | object | class   | type    | housenumber
374           | N10    | place   | houses  | odd
375           | N11    | place   | houses  | odd
376           | N12    | place   | houses  | odd
377
378     Scenario: Shorten tiger:county tags
379         Given the osm nodes:
380           | id  | tags
381           | 10  | 'place' : 'village', 'tiger:county' : 'Feebourgh, AL'
382           | 11  | 'place' : 'village', 'addr:state' : 'Alabama', 'tiger:county' : 'Feebourgh, AL'
383           | 12  | 'place' : 'village', 'tiger:county' : 'Feebourgh'
384         When loading osm data
385         Then table place contains
386           | object | class   | type    | isin
387           | N10    | place   | village | Feebourgh county
388           | N11    | place   | village | Alabama,Feebourgh county
389           | N12    | place   | village | Feebourgh county
390
391     Scenario Outline: Import of address tags
392         Given the osm nodes:
393           | id  | tags
394           | 10  | 'place' : 'village', '<key>' : '<value>'
395         When loading osm data
396         Then table place contains
397           | object | class   | type    | isin
398           | N10    | place   | village | <value>
399
400     Examples:
401       | key             | value
402       | is_in           | Stockholm, Sweden
403       | is_in:country   | Xanadu
404       | addr:suburb     | hinein
405       | addr:county     | le havre
406       | addr:city       | Sydney
407       | addr:state      | Jura
408
409     Scenario: Import of admin level
410         Given the osm nodes:
411           | id  | tags
412           | 10  | 'amenity' : 'hospital', 'admin_level' : '3'
413           | 11  | 'amenity' : 'hospital', 'admin_level' : 'b'
414           | 12  | 'amenity' : 'hospital'
415           | 13  | 'amenity' : 'hospital', 'admin_level' : '3.0'
416         When loading osm data
417         Then table place contains
418           | object | class   | type     | admin_level
419           | N10    | amenity | hospital | 3
420           | N11    | amenity | hospital | 100
421           | N12    | amenity | hospital | 100
422           | N13    | amenity | hospital | 3
423
424     Scenario: Import of extra tags
425         Given the osm nodes:
426           | id  | tags
427           | 10  | 'tourism' : 'hotel', '<key>' : 'foo'
428         When loading osm data
429         Then table place contains
430           | object | class   | type  | extratags
431           | N10    | tourism | hotel | '<key>' : 'foo'
432
433      Examples:
434        | key
435        | tracktype
436        | traffic_calming
437        | service
438        | cuisine
439        | capital
440        | dispensing
441        | religion
442        | denomination
443        | sport
444        | internet_access
445        | lanes
446        | surface
447        | smoothness
448        | width
449        | est_width
450        | incline
451        | opening_hours
452        | collection_times
453        | service_times
454        | disused
455        | wheelchair
456        | sac_scale
457        | trail_visibility
458        | mtb:scale
459        | mtb:description
460        | wood
461        | drive_in
462        | access
463        | vehicle
464        | bicyle
465        | foot
466        | goods
467        | hgv
468        | motor_vehicle
469        | motor_car
470        | access:foot
471        | contact:phone
472        | drink:mate
473        | oneway
474        | date_on
475        | date_off
476        | day_on
477        | day_off
478        | hour_on
479        | hour_off
480        | maxweight
481        | maxheight
482        | maxspeed
483        | disused
484        | toll
485        | charge
486        | population
487        | description
488        | image
489        | attribution
490        | fax
491        | email
492        | url
493        | website
494        | phone
495        | real_ale
496        | smoking
497        | food
498        | camera
499        | brewery
500        | locality
501        | wikipedia
502        | wikipedia:de
503
504     Scenario: buildings
505         Given the osm nodes:
506           | id  | tags
507           | 10  | 'tourism' : 'hotel', 'building' : 'yes'
508           | 11  | 'building' : 'house'
509           | 12  | 'building' : 'shed', 'addr:housenumber' : '1'
510           | 13  | 'building' : 'yes', 'name' : 'Das Haus'
511           | 14  | 'building' : 'yes', 'addr:postcode' : '12345'
512         When loading osm data
513         Then table place contains
514           | object | class   | type
515           | N10    | tourism | hotel
516           | N12    | building| yes
517           | N13    | building| yes
518           | N14    | building| yes
519         And table place has no entry for N10:building
520         And table place has no entry for N11
521
522    Scenario: complete node entry
523        Given the osm nodes:
524          | id        | tags
525          | 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'
526         When loading osm data
527         Then table place contains
528          | object     | class   | type | housenumber
529          | N290393920 | place   | house| 43\