]> git.openstreetmap.org Git - nominatim.git/blob - test/bdd/osm2pgsql/update/tags.feature
ed14429c6e14e2aec45048eff0367055a4b0af59
[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 exactly
35             | object     | indexed_status |
36             | N1:amenity | 100            |
37             | N2:highway | 0              |
38             | N2:railway | 100            |
39             | N3:amenity | 0              |
40
41
42     Scenario: Main tag added
43         When loading osm data
44             """
45             n1 Tatity=restaurant
46             n2 Thighway=bus_stop,name=X
47             """
48         Then place contains exactly
49             | object     | class   | type       |
50             | N2:highway | highway | bus_stop   |
51
52         When updating osm data
53             """
54             n1 Tamenity=restaurant
55             n2 Thighway=bus_stop,railway=stop,name=X
56             """
57         Then place contains exactly
58             | object     | class   | type       |
59             | N1         | amenity | restaurant |
60             | N2:highway | highway | bus_stop   |
61             | N2:railway | railway | stop       |
62         And placex contains exactly
63             | object     | indexed_status |
64             | N1:amenity | 1              |
65             | N2:highway | 0              |
66             | N2:railway | 1              |
67
68
69     Scenario: Main tag modified
70         When loading osm data
71             """
72             n10 Thighway=footway,name=X
73             n11 Tamenity=atm
74             """
75         Then place contains exactly
76             | object | class   | type    |
77             | N10    | highway | footway |
78             | N11    | amenity | atm     |
79
80         When updating osm data
81             """
82             n10 Thighway=path,name=X
83             n11 Thighway=primary
84             """
85         Then place contains exactly
86             | object | class   | type    |
87             | N10    | highway | path    |
88             | N11    | highway | primary |
89         And placex contains
90             | object      | indexed_status |
91             | N11:amenity | 100            |
92             | N11:highway | 1              |
93
94
95     Scenario: Main tags with name, name added
96         When loading osm data
97             """
98             n45 Tlanduse=cemetry
99             n46 Tbuilding=yes
100             """
101         Then place contains exactly
102             | object | class   | type    |
103
104         When updating osm data
105             """
106             n45 Tlanduse=cemetry,name=TODO
107             n46 Tbuilding=yes,addr:housenumber=1
108             """
109         Then place contains exactly
110             | object | class   | type    |
111             | N45    | landuse | cemetry |
112             | N46    | building| yes     |
113         And placex contains exactly
114             | object       | indexed_status |
115             | N45:landuse  | 1              |
116             | N46:building | 1              |
117
118
119     Scenario: Main tags with name, name removed
120         When loading osm data
121             """
122             n45 Tlanduse=cemetry,name=TODO
123             n46 Tbuilding=yes,addr:housenumber=1
124             """
125         Then place contains exactly
126             | object | class   | type    |
127             | N45    | landuse | cemetry |
128             | N46    | building| yes     |
129
130         When updating osm data
131             """
132             n45 Tlanduse=cemetry
133             n46 Tbuilding=yes
134             """
135         Then place contains exactly
136             | object | class   | type    |
137         And placex contains exactly
138             | object       | indexed_status |
139             | N45:landuse  | 100            |
140             | N46:building | 100            |
141
142
143     Scenario: Main tags with name, name modified
144         When loading osm data
145             """
146             n45 Tlanduse=cemetry,name=TODO
147             n46 Tbuilding=yes,addr:housenumber=1
148             """
149         Then place contains exactly
150             | object | class   | type    | name            | address           |
151             | N45    | landuse | cemetry | 'name' : 'TODO' | -                 |
152             | N46    | building| yes     | -               | 'housenumber': '1'|
153
154         When updating osm data
155             """
156             n45 Tlanduse=cemetry,name=DONE
157             n46 Tbuilding=yes,addr:housenumber=10
158             """
159         Then place contains exactly
160             | object | class   | type    | name            | address            |
161             | N45    | landuse | cemetry | 'name' : 'DONE' | -                  |
162             | N46    | building| yes     | -               | 'housenumber': '10'|
163         And placex contains exactly
164             | object       | indexed_status |
165             | N45:landuse  | 2              |
166             | N46:building | 2              |
167
168
169     Scenario: Main tag added to address only node
170         When loading osm data
171             """
172             n1 Taddr:housenumber=345
173             """
174         Then place contains exactly
175             | object | class | type  | address |
176             | N1     | place | house | 'housenumber': '345'|
177
178         When updating osm data
179             """
180             n1 Taddr:housenumber=345,building=yes
181             """
182         Then place contains exactly
183             | object | class    | type  | address |
184             | N1     | building | yes   | 'housenumber': '345'|
185         And placex contains exactly
186             | object       | indexed_status |
187             | N1:place     | 100            |
188             | N1:building  | 1              |
189
190
191     Scenario: Main tag removed from address only node
192         When loading osm data
193             """
194             n1 Taddr:housenumber=345,building=yes
195             """
196         Then place contains exactly
197             | object | class    | type  | address |
198             | N1     | building | yes   | 'housenumber': '345'|
199
200         When updating osm data
201             """
202             n1 Taddr:housenumber=345
203             """
204         Then place contains exactly
205             | object | class | type  | address |
206             | N1     | place | house | 'housenumber': '345'|
207         And placex contains exactly
208             | object       | indexed_status |
209             | N1:place     | 1              |
210             | N1:building  | 100            |
211
212
213     Scenario: Main tags with name key, adding key name
214         When loading osm data
215             """
216             n2 Tbridge=yes
217             """
218         Then place contains exactly
219             | object | class    | type  |
220
221         When updating osm data
222             """
223             n2 Tbridge=yes,bridge:name=high
224             """
225         Then place contains exactly
226             | object | class    | type  | name           |
227             | N2     | bridge   | yes   | 'name': 'high' |
228         And placex contains exactly
229             | object    | indexed_status |
230             | N2:bridge | 1              |
231
232
233     Scenario: Main tags with name key, deleting key name
234         When loading osm data
235             """
236             n2 Tbridge=yes,bridge:name=high
237             """
238         Then place contains exactly
239             | object | class    | type  | name           |
240             | N2     | bridge   | yes   | 'name': 'high' |
241
242         When updating osm data
243             """
244             n2 Tbridge=yes
245             """
246         Then place contains exactly
247             | object | class    | type  |
248         And placex contains exactly
249             | object    | indexed_status |
250             | N2:bridge | 100            |
251
252
253     Scenario: Main tags with name key, changing key name
254         When loading osm data
255             """
256             n2 Tbridge=yes,bridge:name=high
257             """
258         Then place contains exactly
259             | object | class    | type  | name           |
260             | N2     | bridge   | yes   | 'name': 'high' |
261
262         When updating osm data
263             """
264             n2 Tbridge=yes,bridge:name:en=high
265             """
266         Then place contains exactly
267             | object | class    | type  | name           |
268             | N2     | bridge   | yes   | 'name:en': 'high' |
269         And placex contains exactly
270             | object    | indexed_status |
271             | N2:bridge | 2              |
272
273
274     Scenario: Downgrading a highway to one that is dropped without name
275         When loading osm data
276           """
277           n100 x0 y0
278           n101 x0.0001 y0.0001
279           w1 Thighway=residential Nn100,n101
280           """
281         Then place contains exactly
282           | object     |
283           | W1:highway |
284
285         When updating osm data
286           """
287           w1 Thighway=service Nn100,n101
288           """
289         Then place contains exactly
290           | object     |
291         And placex contains exactly
292           | object     | indexed_status |
293           | W1:highway | 100            |
294
295
296     Scenario: Upgrading a highway to one that is not dropped without name
297         When loading osm data
298           """
299           n100 x0 y0
300           n101 x0.0001 y0.0001
301           w1 Thighway=service Nn100,n101
302           """
303         Then place contains exactly
304           | object     |
305
306         When updating osm data
307           """
308           w1 Thighway=unclassified Nn100,n101
309           """
310         Then place contains exactly
311           | object     |
312           | W1:highway |
313         And placex contains exactly
314           | object     | indexed_status |
315           | W1:highway | 1              |
316
317
318     Scenario: Downgrading a highway when a second tag is present
319         When loading osm data
320           """
321           n100 x0 y0
322           n101 x0.0001 y0.0001
323           w1 Thighway=residential,tourism=hotel Nn100,n101
324           """
325         Then place contains exactly
326           | object     |
327           | W1:highway |
328           | W1:tourism |
329
330         When updating osm data
331           """
332           w1 Thighway=service,tourism=hotel Nn100,n101
333           """
334         Then place contains exactly
335           | object     |
336           | W1:tourism |
337         And placex contains exactly
338           | object     |
339           | W1:tourism |
340           | W1:highway |
341         And placex contains
342           | object     | indexed_status |
343           | W1:highway | 100            |
344
345
346     Scenario: Upgrading a highway when a second tag is present
347         When loading osm data
348           """
349           n100 x0 y0
350           n101 x0.0001 y0.0001
351           w1 Thighway=service,tourism=hotel Nn100,n101
352           """
353         Then place contains exactly
354           | object     |
355           | W1:tourism |
356
357         When updating osm data
358           """
359           w1 Thighway=residential,tourism=hotel Nn100,n101
360           """
361         Then place contains exactly
362           | object     |
363           | W1:highway |
364           | W1:tourism |
365         And placex contains exactly
366           | object     | indexed_status |
367           | W1:tourism | 2              |
368           | W1:highway | 1              |