]> git.openstreetmap.org Git - nominatim.git/blob - test/bdd/db/import/addressing.feature
drop illegal values for addr:interpolation on update
[nominatim.git] / test / bdd / db / import / addressing.feature
1 @DB
2 Feature: Address computation
3     Tests for filling of place_addressline
4
5     Scenario: place nodes are added to the address when they are close enough
6         Given the 0.002 grid
7             | 2 |  |  |  |  |  | 1 |  | 3 |
8         And the places
9             | osm | class | type     | name      | geometry |
10             | N1  | place | square   | Square    | 1 |
11             | N2  | place | hamlet   | West Farm | 2 |
12             | N3  | place | hamlet   | East Farm | 3 |
13         When importing
14         Then place_addressline contains
15             | object | address | fromarea |
16             | N1     | N3      | False |
17         Then place_addressline doesn't contain
18             | object | address |
19             | N1     | N2      |
20         When sending search query "Square"
21         Then results contain
22            | osm | display_name      |
23            | N1  | Square, East Farm |
24
25     Scenario: given two place nodes, the closer one wins for the address
26         Given the grid
27             | 2 |  |  | 1 |  | 3 |
28         And the named places
29             | osm | class | type     | geometry |
30             | N1  | place | square   | 1 |
31             | N2  | place | hamlet   | 2 |
32             | N3  | place | hamlet   | 3 |
33         When importing
34         Then place_addressline contains
35             | object | address | fromarea | isaddress |
36             | N1     | N3      | False    | True |
37             | N1     | N2      | False    | False |
38
39     Scenario: boundaries around the place are added to the address
40         Given the grid
41             | 1 |    | 4 | | 7 | 10 |
42             | 2 |    | 5 | | 8 | 11 |
43             |   |    |   | |   |    |
44             |   |    |   | |   |    |
45             |   |    | 6 | | 9 |    |
46             |   | 99 |   | |   |    |
47             | 3 |    |   | |   | 12 |
48         And the named places
49             | osm | class    | type           | admin | geometry |
50             | R1  | boundary | administrative | 3     | (1,2,3,12,11,10,7,8,9,6,5,4,1) |
51             | R2  | boundary | administrative | 4     | (2,3,12,11,8,9,6,5,2) |
52             | N1  | place    | square         | 15    | 99 |
53         When importing
54         Then place_addressline contains
55             | object | address | isaddress |
56             | N1     | R1      | True |
57             | N1     | R2      | True |
58
59     Scenario: with boundaries of same rank the one with the closer centroid is prefered
60         Given the grid
61             | 1 |   |   | 3 |  | 5 |
62             |   | 9 |   |   |  |   |
63             | 2 |   |   | 4 |  | 6 |
64         And the named places
65             | osm | class    | type           | admin | geometry |
66             | R1  | boundary | administrative | 8     | (1,2,4,3,1) |
67             | R2  | boundary | administrative | 8     | (1,2,6,5,1) |
68             | N1  | place    | square         | 15    | 9 |
69         When importing
70         Then place_addressline contains
71             | object | address | isaddress |
72             | N1     | R1      | True |
73             | N1     | R2      | False |
74
75     Scenario: boundary areas are preferred over place nodes in the address
76         Given the grid
77             | 1 |   |   |   | 10 |   | 3 |
78             |   | 5 |   |   |    |   |   |
79             |   | 6 |   |   |    |   |   |
80             | 2 |   |   |   | 11 |   | 4 |
81         And the named places
82             | osm | class    | type           | admin | geometry |
83             | N1  | place    | square         | 15    | 5 |
84             | N2  | place    | city           | 15    | 6 |
85             | R1  | place    | city           | 8     | (1,2,4,3,1) |
86             | R2  | boundary | administrative | 9     | (1,10,11,2,1) |
87         When importing
88         Then place_addressline contains
89             | object | address | isaddress | cached_rank_address |
90             | N1     | R1      | True      | 16                  |
91             | N1     | R2      | True      | 18                  |
92             | N1     | N2      | False     | 18                  |
93
94     Scenario: place nodes outside a smaller ranked area are ignored
95         Given the grid
96             | 1 |   | 2 |   |
97             |   | 7 |   | 9 |
98             | 4 |   | 3 |   |
99         And the named places
100             | osm | class    | type    | admin | geometry |
101             | N1  | place    | square  | 15    | 7 |
102             | N2  | place    | city    | 15    | 9 |
103             | R1  | place    | city    | 8     | (1,2,3,4,1) |
104         When importing
105         Then place_addressline contains
106             | object | address | isaddress | cached_rank_address |
107             | N1     | R1      | True      | 16                  |
108         And place_addressline doesn't contain
109             | object | address |
110             | N1     | N2      |
111
112
113     Scenario: place nodes close enough to smaller ranked place nodes are included
114         Given the 0.002 grid
115             | 2 |   | 3 | 1 |
116         And the named places
117             | osm | class | type     | geometry |
118             | N1  | place | square   | 1 |
119             | N2  | place | hamlet   | 2 |
120             | N3  | place | quarter  | 3 |
121         When importing
122         Then place_addressline contains
123             | object | address | fromarea | isaddress |
124             | N1     | N2      | False    | True      |
125             | N1     | N3      | False    | True      |
126
127
128     Scenario: place nodes too far away from a smaller ranked place nodes are marked non-address
129         Given the 0.002 grid
130             | 2 |  |  | 1 |  | 3 |
131         And the named places
132             | osm | class | type     | geometry |
133             | N1  | place | square   | 1 |
134             | N2  | place | hamlet   | 2 |
135             | N3  | place | quarter  | 3 |
136         When importing
137         Then place_addressline contains
138             | object | address | fromarea | isaddress |
139             | N1     | N2      | False    | True      |
140             | N1     | N3      | False    | False     |
141
142
143     # github #121
144     Scenario: Roads crossing boundaries should contain both states
145         Given the grid
146             | 1 |   |   | 2 |   | 3 |
147             |   | 7 |   |   | 8 |   |
148             | 4 |   |   | 5 |   | 6 |
149         And the named places
150             | osm | class   | type | geometry |
151             | W1  | highway | road | 7, 8     |
152         And the named places
153             | osm | class    | type           | admin | geometry      |
154             | W10 | boundary | administrative | 5     | (1, 2, 5, 4, 1) |
155             | W11 | boundary | administrative | 5     | (2, 3, 6, 5, 2) |
156         When importing
157         Then place_addressline contains
158             | object | address | cached_rank_address |
159             | W1     | W10     | 10                  |
160             | W1     | W11     | 10                  |
161
162
163     Scenario: Roads following a boundary should contain both states
164         Given the grid
165             | 1 |   |   | 2 |   | 3 |
166             |   |   | 8 | 7 |   |   |
167             | 4 |   |   | 5 |   | 6 |
168         And the named places
169             | osm | class   | type | geometry |
170             | W1  | highway | road | 2, 7, 8  |
171         And the named places
172             | osm | class    | type           | admin | geometry      |
173             | W10 | boundary | administrative | 5     | (1, 2, 5, 4, 1) |
174             | W11 | boundary | administrative | 5     | (2, 3, 6, 5, 2) |
175         When importing
176         Then place_addressline contains
177             | object | address | cached_rank_address |
178             | W1     | W10     | 10                  |
179             | W1     | W11     | 10                  |
180
181     Scenario: Roads should not contain boundaries they touch in a end point
182         Given the grid
183             | 1 |   |   | 2 |   | 3 |
184             |   | 7 |   | 8 |   |   |
185             | 4 |   |   | 5 |   | 6 |
186         And the named places
187             | osm | class   | type | geometry |
188             | W1  | highway | road | 7, 8     |
189         And the named places
190             | osm | class    | type           | admin | geometry      |
191             | W10 | boundary | administrative | 5     | (1, 2, 8, 5, 4, 1) |
192             | W11 | boundary | administrative | 5     | (2, 3, 6, 5, 8, 2) |
193         When importing
194         Then place_addressline contains
195             | object | address | cached_rank_address |
196             | W1     | W10     | 10                  |
197         Then place_addressline doesn't contain
198             | object | address |
199             | W1     | W11     |
200
201     Scenario: Roads should not contain boundaries they touch in a middle point
202         Given the grid
203             | 1 |   |   | 2 |   | 3 |
204             |   | 7 |   | 8 |   |   |
205             | 4 |   | 9 | 5 |   | 6 |
206         And the named places
207             | osm | class   | type | geometry |
208             | W1  | highway | road | 7, 8, 9     |
209         And the named places
210             | osm | class    | type           | admin | geometry      |
211             | W10 | boundary | administrative | 5     | (1, 2, 8, 5, 4, 1) |
212             | W11 | boundary | administrative | 5     | (2, 3, 6, 5, 8, 2) |
213         When importing
214         Then place_addressline contains
215             | object | address | cached_rank_address |
216             | W1     | W10     | 10                  |
217         Then place_addressline doesn't contain
218             | object | address |
219             | W1     | W11     |
220
221     Scenario: Locality points should contain all boundaries they touch
222         Given the 0.001 grid
223             | 1 |   |   | 2 |   | 3 |
224             |   |   |   | 8 |   |   |
225             | 4 |   |   | 5 |   | 6 |
226         And the named places
227             | osm | class | type     | geometry |
228             | N1  | place | locality | 8        |
229         And the named places
230             | osm | class    | type           | admin | geometry      |
231             | W10 | boundary | administrative | 5     | (1, 2, 8, 5, 4, 1) |
232             | W11 | boundary | administrative | 5     | (2, 3, 6, 5, 8, 2) |
233         When importing
234         Then place_addressline contains
235             | object | address | cached_rank_address |
236             | N1     | W10     | 10                  |
237             | N1     | W11     | 10                  |
238
239     Scenario: Areas should not contain boundaries they touch
240         Given the grid
241             | 1 |   |   | 2 |   | 3 |
242             |   |   |   |   |   |   |
243             | 4 |   |   | 5 |   | 6 |
244         And the named places
245             | osm | class    | type           | geometry      |
246             | W1  | landuse  | industrial     | (1, 2, 5, 4, 1) |
247         And the named places
248             | osm | class    | type           | admin | geometry      |
249             | W10 | boundary | administrative | 5     | (2, 3, 6, 5, 2) |
250         When importing
251         Then place_addressline doesn't contain
252             | object | address |
253             | W1     | W10     |
254
255     Scenario: buildings with only addr:postcodes do not appear in the address of a way
256         Given the grid with origin DE
257             | 1 |   |   |   |   | 8 |   | 6 |   | 2 |
258             |   |10 |11 |   |   |   |   |   |   |   |
259             |   |13 |12 |   |   |   |   |   |   |   |
260             | 20|   |   | 21|   |   |   |   |   |   |
261             |   |   |   |   |   |   |   |   |   |   |
262             |   |   |   |   |   | 9 |   |   |   |   |
263             | 4 |   |   |   |   |   |   | 7 |   | 3 |
264         And the named places
265             | osm | class    | type           | admin | addr+postcode | geometry   |
266             | R1  | boundary | administrative | 6     | 10000         | (1,2,3,4,1)|
267             | R34 | boundary | administrative | 8     | 11200         | (1,6,7,4,1)|
268             | R4  | boundary | administrative | 10    | 11230         | (1,8,9,4,1)|
269         And the named places
270             | osm | class    | type           | geometry |
271             | W93 | highway  | residential    | 20,21    |
272         And the places
273             | osm | class    | type        | addr+postcode | geometry |
274             | W22 | place    | postcode    | 11234         | (10,11,12,13,10) |
275         When importing
276         Then place_addressline doesn't contain
277             | object | address  |
278             | W93    | W22      |
279
280     Scenario: postcode boundaries do appear in the address of a way
281        Given the grid with origin DE
282             | 1 |   |   |   |   | 8 |   | 6 |   | 2 |
283             |   |10 |11 |   |   |   |   |   |   |   |
284             |   |13 |12 |   |   |   |   |   |   |   |
285             | 20|   |   | 21|   |   |   |   |   |   |
286             |   |   |   |   |   |   |   |   |   |   |
287             |   |   |   |   |   | 9 |   |   |   |   |
288             | 4 |   |   |   |   |   |   | 7 |   | 3 |
289         And the named places
290             | osm | class    | type           | admin | addr+postcode | geometry    |
291             | R1  | boundary | administrative | 6     | 10000         | (1,2,3,4,1) |
292             | R34 | boundary | administrative | 8     | 11000         | (1,6,7,4,1) |
293         And the places
294             | osm | class    | type        | addr+postcode | geometry |
295             | R4  | boundary | postal_code | 11200         | (1,8,9,4,1) |
296         And the named places
297             | osm | class    | type           | geometry |
298             | W93 | highway  | residential    | 20,21    |
299         And the places
300             | osm | class    | type        | addr+postcode | geometry |
301             | W22 | place    | postcode    | 11234         | (10,11,12,13,10) |
302         When importing
303         Then place_addressline contains
304             | object | address |
305             | W93    | R4      |
306
307     Scenario: squares do not appear in the address of a street
308         Given the grid
309             |   | 1 |   | 2 |   |
310             | 8 |   |   |   | 9 |
311             |   | 4 |   | 3 |   |
312         And the named places
313             | osm | class    | type           | geometry |
314             | W1  | highway  | residential    | 8, 9     |
315             | W2  | place    | square         | (1, 2, 3 ,4, 1) |
316         When importing
317         Then place_addressline doesn't contain
318             | object | address |
319             | W1     | W2      |
320
321     Scenario: addr:* tags are honored even when a street is far away from the place
322         Given the grid
323             | 1 |   | 2 |   |   | 5 |
324             |   |   |   | 8 | 9 |   |
325             | 4 |   | 3 |   |   | 6 |
326         And the places
327             | osm | class    | type           | admin | name  | geometry    |
328             | R1  | boundary | administrative | 8     | Left  | (1,2,3,4,1) |
329             | R2  | boundary | administrative | 8     | Right | (2,3,6,5,2) |
330         And the places
331             | osm | class   | type    | addr+city | geometry |
332             | W1  | highway | primary | Left      | 8,9      |
333             | W2  | highway | primary | Right     | 8,9      |
334         When importing
335         Then place_addressline contains
336            | object | address | isaddress |
337            | W1     | R1      | True      |
338            | W1     | R2      | False     |
339            | W2     | R2      | True      |
340         And place_addressline doesn't contain
341            | object | address |
342            | W2     | R1      |
343
344
345     Scenario: addr:* tags are honored even when a POI is far away from the place
346         Given the grid
347             | 1 |   | 2 |   |   | 5 |
348             |   |   |   | 8 | 9 |   |
349             | 4 |   | 3 |   |   | 6 |
350         And the places
351             | osm | class    | type           | admin | name  | geometry    |
352             | R1  | boundary | administrative | 8     | Left  | (1,2,3,4,1) |
353             | R2  | boundary | administrative | 8     | Right | (2,3,6,5,2) |
354         And the places
355             | osm | class   | type    | name      | addr+city | geometry |
356             | W1  | highway | primary | Wonderway | Right     | 8,9      |
357             | N1  | amenity | cafe    | Bolder    | Left      | 9        |
358         When importing
359         Then place_addressline contains
360            | object | address | isaddress |
361            | W1     | R2      | True      |
362            | N1     | R1      | True      |
363         And place_addressline doesn't contain
364            | object | address |
365            | W1     | R1      |
366         When sending search query "Bolder"
367         Then results contain
368            | osm | display_name            |
369            | N1  | Bolder, Wonderway, Left |
370
371     Scenario: addr:* tags do not produce addresslines when the parent has the address part
372         Given the grid
373             | 1 |   |   | 5 |
374             |   | 8 | 9 |   |
375             | 4 |   |   | 6 |
376         And the places
377             | osm | class    | type           | admin | name  | geometry    |
378             | R1  | boundary | administrative | 8     | Outer | (1,5,6,4,1) |
379         And the places
380             | osm | class   | type    | name      | addr+city | geometry |
381             | W1  | highway | primary | Wonderway | Outer     | 8,9      |
382             | N1  | amenity | cafe    | Bolder    | Outer     | 9        |
383         When importing
384         Then place_addressline contains
385            | object | address | isaddress |
386            | W1     | R1      | True      |
387         And place_addressline doesn't contain
388            | object | address |
389            | N1     | R1      |
390         When sending search query "Bolder"
391         Then results contain
392            | osm | display_name             |
393            | N1  | Bolder, Wonderway, Outer |
394
395     Scenario: addr:* tags on outside do not produce addresslines when the parent has the address part
396         Given the grid
397             | 1 |   | 2 |   |   | 5 |
398             |   |   |   | 8 | 9 |   |
399             | 4 |   | 3 |   |   | 6 |
400         And the places
401             | osm | class    | type           | admin | name  | geometry    |
402             | R1  | boundary | administrative | 8     | Left  | (1,2,3,4,1) |
403             | R2  | boundary | administrative | 8     | Right | (2,3,6,5,2) |
404         And the places
405             | osm | class   | type    | name      | addr+city | geometry |
406             | W1  | highway | primary | Wonderway | Left      | 8,9      |
407             | N1  | amenity | cafe    | Bolder    | Left      | 9        |
408         When importing
409         Then place_addressline contains
410            | object | address | isaddress |
411            | W1     | R1      | True      |
412            | W1     | R2      | False     |
413         And place_addressline doesn't contain
414            | object | address |
415            | N1     | R1      |
416         When sending search query "Bolder"
417         Then results contain
418            | osm | display_name            |
419            | N1  | Bolder, Wonderway, Left |
420
421     Scenario: POIs can correct address parts on the fly
422         Given the grid
423             | 1 |   |   |   |  2 |   | 5 |
424             |   |   |   | 9 |    | 8 |   |
425             | 4 |   |   |   |  3 |   | 6 |
426         And the places
427             | osm | class    | type           | admin | name  | geometry    |
428             | R1  | boundary | administrative | 8     | Left  | (1,2,3,4,1) |
429             | R2  | boundary | administrative | 8     | Right | (2,3,6,5,2) |
430         And the places
431             | osm | class   | type    | name      | geometry |
432             | W1  | highway | primary | Wonderway | 2,3      |
433             | N1  | amenity | cafe    | Bolder    | 9        |
434             | N2  | amenity | cafe    | Leftside  | 8        |
435         When importing
436         Then place_addressline contains
437            | object | address | isaddress |
438            | W1     | R1      | False     |
439            | W1     | R2      | True      |
440         And place_addressline doesn't contain
441            | object | address |
442            | N1     | R1      |
443            | N2     | R2      |
444         When sending search query "Bolder"
445         Then results contain
446            | osm | display_name            |
447            | N1  | Bolder, Wonderway, Left |
448         When sending search query "Leftside"
449         Then results contain
450            | osm | display_name               |
451            | N2  | Leftside, Wonderway, Right |
452
453
454     Scenario: POIs can correct address parts on the fly (with partial unmatching address)
455         Given the grid
456             | 1 |   |   |   |  2 |   | 5 |
457             |   |   |   | 9 |    | 8 |   |
458             |   | 10| 11|   |    | 12|   |
459             | 4 |   |   |   |  3 |   | 6 |
460         And the places
461             | osm | class    | type           | admin | name  | geometry    |
462             | R1  | boundary | administrative | 8     | Left  | (1,2,3,4,1) |
463             | R2  | boundary | administrative | 8     | Right | (2,3,6,5,2) |
464         And the places
465             | osm | class   | type    | name      | geometry |
466             | W1  | highway | primary | Wonderway | 10,11,12 |
467         And the places
468             | osm | class   | type    | name      | addr+suburb | geometry |
469             | N1  | amenity | cafe    | Bolder    | Boring      | 9        |
470             | N2  | amenity | cafe    | Leftside  | Boring      | 8        |
471         When importing
472         Then place_addressline contains
473            | object | address | isaddress |
474            | W1     | R1      | True      |
475            | W1     | R2      | False     |
476         And place_addressline doesn't contain
477            | object | address |
478            | N1     | R1      |
479            | N2     | R2      |
480         When sending search query "Bolder"
481         Then results contain
482            | osm | display_name            |
483            | N1  | Bolder, Wonderway, Left |
484         When sending search query "Leftside"
485         Then results contain
486            | osm | display_name               |
487            | N2  | Leftside, Wonderway, Right |
488
489
490
491     Scenario: POIs can correct address parts on the fly (with partial matching address)
492         Given the grid
493             | 1 |   |   |   |  2 |   | 5 |
494             |   |   |   | 9 |    | 8 |   |
495             |   | 10| 11|   |    | 12|   |
496             | 4 |   |   |   |  3 |   | 6 |
497         And the places
498             | osm | class    | type           | admin | name  | geometry    |
499             | R1  | boundary | administrative | 8     | Left  | (1,2,3,4,1) |
500             | R2  | boundary | administrative | 8     | Right | (2,3,6,5,2) |
501         And the places
502             | osm | class   | type    | name      | geometry |
503             | W1  | highway | primary | Wonderway | 10,11,12 |
504         And the places
505             | osm | class   | type    | name      | addr+state | geometry |
506             | N1  | amenity | cafe    | Bolder    | Left       | 9        |
507             | N2  | amenity | cafe    | Leftside  | Left       | 8        |
508         When importing
509         Then place_addressline contains
510            | object | address | isaddress |
511            | W1     | R1      | True      |
512            | W1     | R2      | False     |
513         And place_addressline doesn't contain
514            | object | address |
515            | N1     | R1      |
516            | N2     | R2      |
517         When sending search query "Bolder"
518         Then results contain
519            | osm | display_name            |
520            | N1  | Bolder, Wonderway, Left |
521         When sending search query "Leftside"
522         Then results contain
523            | osm | display_name               |
524            | N2  | Leftside, Wonderway, Left |
525
526
527     Scenario: addr:* tags always match the closer area
528         Given the grid
529             | 1 |   |   |   |  2 |   | 5 |
530             |   |   |   |   |    |   |   |
531             |   | 10| 11|   |    |   |   |
532             | 4 |   |   |   |  3 |   | 6 |
533         And the places
534             | osm | class    | type           | admin | name  | geometry    |
535             | R1  | boundary | administrative | 8     | Left  | (1,2,3,4,1) |
536             | R2  | boundary | administrative | 8     | Left  | (2,3,6,5,2) |
537         And the places
538             | osm | class   | type    | name      | addr+city | geometry |
539             | W1  | highway | primary | Wonderway | Left      | 10,11    |
540         When importing
541         Then place_addressline doesn't contain
542             | object | address |
543             | W1     | R2      |
544