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