]> git.openstreetmap.org Git - nominatim.git/blob - test/bdd/osm2pgsql/update/tags.feature
f617c38fc152acd97c94d6c5a15591d729ac1878
[nominatim.git] / test / bdd / osm2pgsql / update / tags.feature
1 @DB
2 Feature: Tag evaluation
3     Tests if tags are correctly updated in the place table
4
5     Background:
6         Given the grid
7             | 1  | 2  | 3 |
8             | 10 | 11 |   |
9             | 45 | 46 |   |
10
11     Scenario: Main tag deleted
12         When loading osm data
13             """
14             n1 Tamenity=restaurant
15             n2 Thighway=bus_stop,railway=stop,name=X
16             n3 Tamenity=prison
17             """
18         Then place contains exactly
19             | object     | class   | type       |
20             | N1         | amenity | restaurant |
21             | N2:highway | highway | bus_stop   |
22             | N2:railway | railway | stop       |
23             | N3         | amenity | prison     |
24
25         When updating osm data
26             """
27             n1 Tnot_a=restaurant
28             n2 Thighway=bus_stop,name=X
29             """
30         Then place contains exactly
31             | object     | class   | type       |
32             | N2:highway | highway | bus_stop   |
33             | N3         | amenity | prison     |
34         And placex contains
35             | object     | indexed_status |
36             | N1:amenity | 100            |
37             | N2:railway | 100            |
38             | N3:amenity | 0              |
39
40
41     Scenario: Main tag added
42         When loading osm data
43             """
44             n1 Tatity=restaurant
45             n2 Thighway=bus_stop,name=X
46             """
47         Then place contains exactly
48             | object     | class   | type       |
49             | N2:highway | highway | bus_stop   |
50
51         When updating osm data
52             """
53             n1 Tamenity=restaurant
54             n2 Thighway=bus_stop,railway=stop,name=X
55             """
56         Then place contains exactly
57             | object     | class   | type       |
58             | N1         | amenity | restaurant |
59             | N2:highway | highway | bus_stop   |
60             | N2:railway | railway | stop       |
61         And placex contains
62             | object     | indexed_status |
63             | N1:amenity | 1              |
64             | N2:railway | 1              |
65
66
67     Scenario: Main tag modified
68         When loading osm data
69             """
70             n10 Thighway=footway,name=X
71             n11 Tamenity=atm
72             """
73         Then place contains exactly
74             | object | class   | type    |
75             | N10    | highway | footway |
76             | N11    | amenity | atm     |
77
78         When updating osm data
79             """
80             n10 Thighway=path,name=X
81             n11 Thighway=primary
82             """
83         Then place contains exactly
84             | object | class   | type    |
85             | N10    | highway | path    |
86             | N11    | highway | primary |
87         And placex contains
88             | object      | indexed_status |
89             | N11:amenity | 100            |
90             | N11:highway | 1              |
91
92
93     Scenario: Main tags with name, name added
94         When loading osm data
95             """
96             n45 Tlanduse=cemetry
97             n46 Tbuilding=yes
98             """
99         Then place contains exactly
100             | object | class   | type    |
101
102         When updating osm data
103             """
104             n45 Tlanduse=cemetry,name=TODO
105             n46 Tbuilding=yes,addr:housenumber=1
106             """
107         Then place contains exactly
108             | object | class   | type    |
109             | N45    | landuse | cemetry |
110             | N46    | building| yes     |
111         And placex contains exactly
112             | object       | indexed_status |
113             | N45:landuse  | 1              |
114             | N46:building | 1              |
115
116
117     Scenario: Main tags with name, name removed
118         When loading osm data
119             """
120             n45 Tlanduse=cemetry,name=TODO
121             n46 Tbuilding=yes,addr:housenumber=1
122             """
123         Then place contains exactly
124             | object | class   | type    |
125             | N45    | landuse | cemetry |
126             | N46    | building| yes     |
127
128         When updating osm data
129             """
130             n45 Tlanduse=cemetry
131             n46 Tbuilding=yes
132             """
133         Then place contains exactly
134             | object | class   | type    |
135         And placex contains exactly
136             | object       | indexed_status |
137             | N45:landuse  | 100            |
138             | N46:building | 100            |
139
140
141     Scenario: Main tags with name, name modified
142         When loading osm data
143             """
144             n45 Tlanduse=cemetry,name=TODO
145             n46 Tbuilding=yes,addr:housenumber=1
146             """
147         Then place contains exactly
148             | object | class   | type    | name            | address           |
149             | N45    | landuse | cemetry | 'name' : 'TODO' | -                 |
150             | N46    | building| yes     | -               | 'housenumber': '1'|
151
152         When updating osm data
153             """
154             n45 Tlanduse=cemetry,name=DONE
155             n46 Tbuilding=yes,addr:housenumber=10
156             """
157         Then place contains exactly
158             | object | class   | type    | name            | address            |
159             | N45    | landuse | cemetry | 'name' : 'DONE' | -                  |
160             | N46    | building| yes     | -               | 'housenumber': '10'|
161         And placex contains exactly
162             | object       | indexed_status |
163             | N45:landuse  | 2              |
164             | N46:building | 2              |
165
166
167     Scenario: Main tag added to address only node
168         When loading osm data
169             """
170             n1 Taddr:housenumber=345
171             """
172         Then place contains exactly
173             | object | class | type  | address |
174             | N1     | place | house | 'housenumber': '345'|
175
176         When updating osm data
177             """
178             n1 Taddr:housenumber=345,building=yes
179             """
180         Then place contains exactly
181             | object | class    | type  | address |
182             | N1     | building | yes   | 'housenumber': '345'|
183         And placex contains exactly
184             | object       | indexed_status |
185             | N1:place     | 100            |
186             | N1:building  | 1              |
187
188
189     Scenario: Main tag removed from address only node
190         When loading osm data
191             """
192             n1 Taddr:housenumber=345,building=yes
193             """
194         Then place contains exactly
195             | object | class    | type  | address |
196             | N1     | building | yes   | 'housenumber': '345'|
197
198         When updating osm data
199             """
200             n1 Taddr:housenumber=345
201             """
202         Then place contains exactly
203             | object | class | type  | address |
204             | N1     | place | house | 'housenumber': '345'|
205         And placex contains exactly
206             | object       | indexed_status |
207             | N1:place     | 1              |
208             | N1:building  | 100            |
209
210
211     Scenario: Main tags with name key, adding key name
212         When loading osm data
213             """
214             n2 Tbridge=yes
215             """
216         Then place contains exactly
217             | object | class    | type  |
218
219         When updating osm data
220             """
221             n2 Tbridge=yes,bridge:name=high
222             """
223         Then place contains exactly
224             | object | class    | type  | name           |
225             | N2     | bridge   | yes   | 'name': 'high' |
226         And placex contains exactly
227             | object    | indexed_status |
228             | N2:bridge | 1              |
229
230
231     Scenario: Main tags with name key, deleting key name
232         When loading osm data
233             """
234             n2 Tbridge=yes,bridge:name=high
235             """
236         Then place contains exactly
237             | object | class    | type  | name           |
238             | N2     | bridge   | yes   | 'name': 'high' |
239
240         When updating osm data
241             """
242             n2 Tbridge=yes
243             """
244         Then place contains exactly
245             | object | class    | type  |
246         And placex contains exactly
247             | object    | indexed_status |
248             | N2:bridge | 100            |
249
250
251     Scenario: Main tags with name key, changing key name
252         When loading osm data
253             """
254             n2 Tbridge=yes,bridge:name=high
255             """
256         Then place contains exactly
257             | object | class    | type  | name           |
258             | N2     | bridge   | yes   | 'name': 'high' |
259
260         When updating osm data
261             """
262             n2 Tbridge=yes,bridge:name:en=high
263             """
264         Then place contains exactly
265             | object | class    | type  | name           |
266             | N2     | bridge   | yes   | 'name:en': 'high' |
267         And placex contains exactly
268             | object    | indexed_status |
269             | N2:bridge | 2              |
270
271
272     Scenario: Downgrading a highway to one that is dropped without name
273         When loading osm data
274           """
275           n100 x0 y0
276           n101 x0.0001 y0.0001
277           w1 Thighway=residential Nn100,n101
278           """
279         Then place contains exactly
280           | object     |
281           | W1:highway |
282
283         When updating osm data
284           """
285           w1 Thighway=service Nn100,n101
286           """
287         Then place contains exactly
288           | object     |
289         And placex contains exactly
290           | object     | indexed_status |
291           | W1:highway | 100            |
292
293
294     Scenario: Upgrading a highway to one that is not dropped without name
295         When loading osm data
296           """
297           n100 x0 y0
298           n101 x0.0001 y0.0001
299           w1 Thighway=service Nn100,n101
300           """
301         Then place contains exactly
302           | object     |
303
304         When updating osm data
305           """
306           w1 Thighway=unclassified Nn100,n101
307           """
308         Then place contains exactly
309           | object     |
310           | W1:highway |
311         And placex contains exactly
312           | object     | indexed_status |
313           | W1:highway | 1              |
314
315
316     Scenario: Downgrading a highway when a second tag is present
317         When loading osm data
318           """
319           n100 x0 y0
320           n101 x0.0001 y0.0001
321           w1 Thighway=residential,tourism=hotel Nn100,n101
322           """
323         Then place contains exactly
324           | object     |
325           | W1:highway |
326           | W1:tourism |
327
328         When updating osm data
329           """
330           w1 Thighway=service,tourism=hotel Nn100,n101
331           """
332         Then place contains exactly
333           | object     |
334           | W1:tourism |
335         And placex contains exactly
336           | object     |
337           | W1:tourism |
338           | W1:highway |
339         And placex contains
340           | object     | indexed_status |
341           | W1:highway | 100            |
342
343
344     Scenario: Upgrading a highway when a second tag is present
345         When loading osm data
346           """
347           n100 x0 y0
348           n101 x0.0001 y0.0001
349           w1 Thighway=service,tourism=hotel Nn100,n101
350           """
351         Then place contains exactly
352           | object     |
353           | W1:tourism |
354
355         When updating osm data
356           """
357           w1 Thighway=residential,tourism=hotel Nn100,n101
358           """
359         Then place contains exactly
360           | object     |
361           | W1:highway |
362           | W1:tourism |
363         And placex contains exactly
364           | object     | indexed_status |
365           | W1:tourism | 2              |
366           | W1:highway | 1              |
367
368
369     Scenario: Replay on administrative boundary
370         When loading osm data
371           """
372           n10 x34.0 y-4.23
373           n11 x34.1 y-4.23
374           n12 x34.2 y-4.13
375           w10 Tboundary=administrative,waterway=river,name=Border,admin_level=2 Nn12,n11,n10
376           """
377         Then place contains exactly
378           | object       |
379           | W10:waterway |
380           | W10:boundary |
381
382         When updating osm data
383           """
384           w10 Tboundary=administrative,waterway=river,name=Border,admin_level=2 Nn12,n11,n10
385           """
386         Then place contains exactly
387           | object       |
388           | W10:waterway |
389           | W10:boundary |
390         And placex contains exactly
391           | object       |
392           | W10:waterway |
393
394
395     Scenario: Change admin_level on administrative boundary
396         When loading osm data
397           """
398           n10 x34.0 y-4.23
399           n11 x34.1 y-4.23
400           n12 x34.2 y-4.13
401           w10 Tboundary=administrative,name=Border,admin_level=2 Nn12,n11,n10
402           """
403         Then place contains exactly
404           | object       | admin_level |
405           | W10:boundary | 2           |
406
407         When updating osm data
408           """
409           w10 Tboundary=administrative,name=Border,admin_level=4 Nn12,n11,n10
410           """
411         Then place contains exactly
412           | object       | admin_level |
413           | W10:boundary | 4           |