]> git.openstreetmap.org Git - nominatim.git/blob - test/bdd/osm2pgsql/import/tags.feature
f4ebe7adf23908b7547a0ce648e7ee0fe6968184
[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: Main tags as fallback
6         When loading osm data
7             """
8             n100 Tjunction=yes,highway=bus_stop
9             n101 Tjunction=yes,name=Bar
10             n200 Tbuilding=yes,amenity=cafe
11             n201 Tbuilding=yes,name=Intersting
12             n202 Tbuilding=yes
13             """
14         Then place contains exactly
15             | object | class    | type     |
16             | N100   | highway  | bus_stop |
17             | N101   | junction | yes      |
18             | N200   | amenity  | cafe     |
19             | N201   | building | yes      |
20
21
22     Scenario: Name and reg tags
23         When loading osm data
24             """
25             n2001 Thighway=road,name=Foo,alt_name:de=Bar,ref=45
26             n2002 Thighway=road,name:prefix=Pre,name:suffix=Post,ref:de=55
27             n2003 Thighway=yes,name:%20%de=Foo,name=real1
28             n2004 Thighway=yes,name:%a%de=Foo,name=real2
29             n2005 Thighway=yes,name:%9%de=Foo,name:\\=real3
30             n2006 Thighway=yes,name:%9%de=Foo,name=rea\l3
31             """
32         Then place contains exactly
33             | object | class   | type | name |
34             | N2001  | highway | road | 'name': 'Foo', 'alt_name:de': 'Bar', 'ref': '45' |
35             | N2002  | highway | road | - |
36             | N2003  | highway | yes  | 'name: de': 'Foo', 'name': 'real1' |
37             | N2004  | highway | yes  | 'name:\nde': 'Foo', 'name': 'real2' |
38             | N2005  | highway | yes  | 'name:\tde': 'Foo', 'name:\\\\': 'real3' |
39             | N2006  | highway | yes  | 'name:\tde': 'Foo', 'name': 'rea\\l3' |
40
41         And place contains
42             | object | extratags |
43             | N2002  | 'name:prefix': 'Pre', 'name:suffix': 'Post', 'ref:de': '55' |
44
45
46     Scenario: Name when using with_name flag
47         When loading osm data
48             """
49             n3001 Tbridge=yes,bridge:name=GoldenGate
50             n3002 Tbridge=yes,bridge:name:en=Rainbow
51             """
52         Then place contains exactly
53             | object | class   | type | name                 |
54             | N3001  | bridge  | yes  | 'name': 'GoldenGate' |
55             | N3002  | bridge  | yes  | 'name:en': 'Rainbow' |
56
57
58     Scenario: Address tags
59         When loading osm data
60             """
61             n4001 Taddr:housenumber=34,addr:city=Esmarald,addr:county=Land
62             n4002 Taddr:streetnumber=10,is_in:city=Rootoo,is_in=Gold
63             """
64         Then place contains exactly
65             | object | class | address             |
66             | N4001  | place | 'housenumber': '34', 'city': 'Esmarald', 'county': 'Land' |
67             | N4002  | place | 'streetnumber': '10', 'city': 'Rootoo' |
68
69
70     Scenario: Country codes
71         When loading osm data
72             """
73             n5001 Tshop=yes,country_code=DE
74             n5002 Tshop=yes,country_code=toolong
75             n5003 Tshop=yes,country_code=x
76             n5004 Tshop=yes,addr:country=us
77             n5005 Tshop=yes,country=be
78             n5006 Tshop=yes,addr:country=France
79             """
80         Then place contains exactly
81             | object | class | address         |
82             | N5001  | shop  | 'country': 'DE' |
83             | N5002  | shop  | - |
84             | N5003  | shop  | - |
85             | N5004  | shop  | 'country': 'us' |
86             | N5005  | shop  | - |
87             | N5006  | shop  | - |
88
89
90     Scenario: Postcodes
91         When loading osm data
92             """
93             n6001 Tshop=bank,addr:postcode=12345
94             n6002 Tshop=bank,tiger:zip_left=34343
95             n6003 Tshop=bank,is_in:postcode=9009
96             """
97         Then place contains exactly
98             | object | class | address             |
99             | N6001  | shop  | 'postcode': '12345' |
100             | N6002  | shop  | 'postcode': '34343' |
101             | N6003  | shop  | -                   |
102
103
104     Scenario: Postcode areas
105         When loading osm data
106             """
107             n1 x12.36853 y51.50618
108             n2 x12.36853 y51.42362
109             n3 x12.63666 y51.42362
110             n4 x12.63666 y51.50618
111             w1 Tboundary=postal_code,ref=3456 Nn1,n2,n3,n4,n1
112             """
113         Then place contains exactly
114             | object | class    | type        | name          |
115             | W1     | boundary | postal_code | 'ref': '3456' |
116
117     Scenario: Main with extra
118         When loading osm data
119             """
120             n7001 Thighway=primary,bridge=yes,name=1
121             n7002 Thighway=primary,bridge=yes,bridge:name=1
122             """
123         Then place contains exactly
124             | object        | class   | type    | name        | extratags+bridge:name |
125             | N7001         | highway | primary | 'name': '1' | -                     |
126             | N7002:highway | highway | primary | -           | 1                     |
127             | N7002:bridge  | bridge  | yes     | 'name': '1' | 1                     |
128
129
130     Scenario: Global fallback and skipping
131         When loading osm data
132             """
133             n8001 Tshop=shoes,note:de=Nein,xx=yy
134             n8002 Tshop=shoes,natural=no,ele=234
135             n8003 Tshop=shoes,name:source=survey
136             """
137         Then place contains exactly
138             | object | class | name | extratags    |
139             | N8001  | shop  |  -   | 'xx': 'yy'   |
140             | N8002  | shop  |  -   | 'ele': '234' |
141             | N8003  | shop  |  -   | -            |
142
143
144     Scenario: Admin levels
145         When loading osm data
146             """
147             n9001 Tplace=city
148             n9002 Tplace=city,admin_level=16
149             n9003 Tplace=city,admin_level=x
150             n9004 Tplace=city,admin_level=1
151             n9005 Tplace=city,admin_level=0
152             n9006 Tplace=city,admin_level=2.5
153             """
154         Then place contains exactly
155             | object | class | admin_level |
156             | N9001  | place | 15          |
157             | N9002  | place | 15          |
158             | N9003  | place | 15          |
159             | N9004  | place | 1           |
160             | N9005  | place | 15          |
161             | N9006  | place | 15          |
162
163
164     Scenario: Administrative boundaries with place tags
165         When loading osm data
166             """
167             n10001 Tboundary=administrative,place=city,name=A
168             n10002 Tboundary=natural,place=city,name=B
169             n10003 Tboundary=administrative,place=island,name=C
170             """
171         Then place contains
172             | object          | class    | type           | extratags       |
173             | N10001          | boundary | administrative | 'place': 'city' |
174         And place contains
175             | object          | class    | type           |
176             | N10002:boundary | boundary | natural        |
177             | N10002:place    | place    | city           |
178             | N10003:boundary | boundary | administrative |
179             | N10003:place    | place    | island         |
180
181
182     Scenario: Building fallbacks
183         When loading osm data
184             """
185             n12001 Ttourism=hotel,building=yes
186             n12002 Tbuilding=house
187             n12003 Tbuilding=shed,addr:housenumber=1
188             n12004 Tbuilding=yes,name=Das-Haus
189             n12005 Tbuilding=yes,addr:postcode=12345
190             """
191         Then place contains exactly
192             | object | class    | type     |
193             | N12001 | tourism  | hotel    |
194             | N12003 | building | shed     |
195             | N12004 | building | yes      |
196             | N12005 | place    | postcode |
197
198
199     Scenario: Address interpolations
200         When loading osm data
201             """
202             n13001 Taddr:interpolation=odd
203             n13002 Taddr:interpolation=even,place=city
204             """
205         Then place contains exactly
206             | object | class | type   | address                 |
207             | N13001 | place | houses | 'interpolation': 'odd'  |
208             | N13002 | place | houses | 'interpolation': 'even' |
209
210
211     Scenario: Footways
212         When loading osm data
213             """
214             n1 x0.0 y0.0
215             n2 x0 y0.0001
216             w1 Thighway=footway Nn1,n2
217             w2 Thighway=footway,name=Road Nn1,n2
218             w3 Thighway=footway,name=Road,footway=sidewalk Nn1,n2
219             w4 Thighway=footway,name=Road,footway=crossing Nn1,n2
220             w5 Thighway=footway,name=Road,footway=residential Nn1,n2
221             """
222         Then place contains exactly
223             | object | name+name |
224             | W2     | Road      |
225             | W5     | Road      |
226
227
228     Scenario: Tourism information
229         When loading osm data
230             """
231             n100 Ttourism=information
232             n101 Ttourism=information,name=Generic
233             n102 Ttourism=information,information=guidepost
234             n103 Thighway=information,information=house
235             """
236         Then place contains exactly
237             | object           | type        |
238             | N101:tourism     | information |
239             | N102:information | guidepost   |
240             | N103:highway     | information |
241
242
243     Scenario: Water feautures
244         When loading osm data
245             """
246             n20 Tnatural=water
247             n21 Tnatural=water,name=SomePond
248             n22 Tnatural=water,water=pond
249             n23 Tnatural=water,water=pond,name=Pond
250             n24 Tnatural=water,water=river,name=BigRiver
251             n25 Tnatural=water,water=yes
252             n26 Tnatural=water,water=yes,name=Random
253             """
254         Then place contains exactly
255             | object      | type  |
256             | N21:natural | water |
257             | N23:water   | pond  |
258             | N26:natural | water |
259
260     Scenario: Drop name for address fallback
261         When loading osm data
262             """
263             n1 Taddr:housenumber=23,name=Foo
264             n2 Taddr:housenumber=23,addr:housename=Foo
265             n3 Taddr:housenumber=23
266             """
267         Then place contains exactly
268             | object      | type  | address             | name |
269             | N1:place    | house | 'housenumber': '23' | -    |
270             | N2:place    | house | 'housenumber': '23' | 'addr:housename': 'Foo' |
271             | N3:place    | house | 'housenumber': '23' | -    |
272
273
274     Scenario: Waterway locks
275         When loading osm data
276             """
277             n1 Twaterway=river,lock=yes
278             n2 Twaterway=river,lock=yes,lock_name=LeLock
279             n3 Twaterway=river,lock=yes,name=LeWater
280             n4 Tamenity=parking,lock=yes,lock_name=Gold
281             """
282         Then place contains exactly
283             | object      | type    | name |
284             | N2:lock     | yes     | 'name': 'LeLock' |
285             | N3:waterway | river   | 'name': 'LeWater' |
286             | N4:amenity  | parking | - |