2 Feature: Address computation
3 Tests for filling of place_addressline
5 Scenario: place nodes are added to the address when they are close enough
7 | 2 | | | | | | 1 | | 3 |
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 |
14 Then place_addressline contains
15 | object | address | fromarea |
17 Then place_addressline doesn't contain
20 When sending search query "Square"
22 | osm | display_name |
23 | N1 | Square, East Farm |
25 Scenario: given two place nodes, the closer one wins for the address
29 | osm | class | type | geometry |
30 | N1 | place | square | 1 |
31 | N2 | place | hamlet | 2 |
32 | N3 | place | hamlet | 3 |
34 Then place_addressline contains
35 | object | address | fromarea | isaddress |
36 | N1 | N3 | False | True |
37 | N1 | N2 | False | False |
39 Scenario: boundaries around the place are added to the address
41 | 1 | | 4 | | 7 | 10 |
42 | 2 | | 5 | | 8 | 11 |
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 |
54 Then place_addressline contains
55 | object | address | isaddress |
59 Scenario: with boundaries of same rank the one with the closer centroid is preferred
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 |
70 Then place_addressline contains
71 | object | address | isaddress |
75 Scenario: boundary areas are preferred over place nodes in the address
77 | 1 | | | | 10 | | 3 |
80 | 2 | | | | 11 | | 4 |
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) |
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 |
94 Scenario: place nodes outside a smaller ranked area are ignored
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) |
105 Then place_addressline contains
106 | object | address | isaddress | cached_rank_address |
107 | N1 | R1 | True | 16 |
108 And place_addressline doesn't contain
113 Scenario: place nodes close enough to smaller ranked place nodes are included
117 | osm | class | type | geometry |
118 | N1 | place | square | 1 |
119 | N2 | place | hamlet | 2 |
120 | N3 | place | quarter | 3 |
122 Then place_addressline contains
123 | object | address | fromarea | isaddress |
124 | N1 | N2 | False | True |
125 | N1 | N3 | False | True |
128 Scenario: place nodes too far away from a smaller ranked place nodes are marked non-address
132 | osm | class | type | geometry |
133 | N1 | place | square | 1 |
134 | N2 | place | hamlet | 2 |
135 | N3 | place | quarter | 3 |
137 Then place_addressline contains
138 | object | address | fromarea | isaddress |
139 | N1 | N2 | False | True |
140 | N1 | N3 | False | False |
144 Scenario: Roads crossing boundaries should contain both states
150 | osm | class | type | geometry |
151 | W1 | highway | road | 7, 8 |
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) |
157 Then place_addressline contains
158 | object | address | cached_rank_address |
163 Scenario: Roads following a boundary should contain both states
169 | osm | class | type | geometry |
170 | W1 | highway | road | 2, 7, 8 |
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) |
176 Then place_addressline contains
177 | object | address | cached_rank_address |
181 Scenario: Roads should not contain boundaries they touch in a end point
187 | osm | class | type | geometry |
188 | W1 | highway | road | 7, 8 |
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) |
194 Then place_addressline contains
195 | object | address | cached_rank_address |
197 Then place_addressline doesn't contain
201 Scenario: Roads should not contain boundaries they touch in a middle point
205 | 4 | | 9 | 5 | | 6 |
207 | osm | class | type | geometry |
208 | W1 | highway | road | 7, 8, 9 |
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) |
214 Then place_addressline contains
215 | object | address | cached_rank_address |
217 Then place_addressline doesn't contain
221 Scenario: Locality points should contain all boundaries they touch
227 | osm | class | type | geometry |
228 | N1 | place | locality | 8 |
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) |
234 Then place_addressline contains
235 | object | address | cached_rank_address |
239 Scenario: Areas should not contain boundaries they touch
245 | osm | class | type | geometry |
246 | W1 | landuse | industrial | (1, 2, 5, 4, 1) |
248 | osm | class | type | admin | geometry |
249 | W10 | boundary | administrative | 5 | (2, 3, 6, 5, 2) |
251 Then place_addressline doesn't contain
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 |
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)|
270 | osm | class | type | geometry |
271 | W93 | highway | residential | 20,21 |
273 | osm | class | type | addr+postcode | geometry |
274 | W22 | place | postcode | 11234 | (10,11,12,13,10) |
276 Then place_addressline doesn't contain
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 |
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) |
294 | osm | class | type | addr+postcode | geometry |
295 | R4 | boundary | postal_code | 11200 | (1,8,9,4,1) |
297 | osm | class | type | geometry |
298 | W93 | highway | residential | 20,21 |
300 | osm | class | type | addr+postcode | geometry |
301 | W22 | place | postcode | 11234 | (10,11,12,13,10) |
303 Then place_addressline contains
307 Scenario: squares do not appear in the address of a street
313 | osm | class | type | geometry |
314 | W1 | highway | residential | 8, 9 |
315 | W2 | place | square | (1, 2, 3 ,4, 1) |
317 Then place_addressline doesn't contain
321 Scenario: addr:* tags are honored even when a street is far away from the place
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) |
331 | osm | class | type | addr+city | geometry |
332 | W1 | highway | primary | Left | 8,9 |
333 | W2 | highway | primary | Right | 8,9 |
335 Then place_addressline contains
336 | object | address | isaddress |
340 And place_addressline doesn't contain
345 Scenario: addr:* tags are honored even when a POI is far away from the place
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) |
355 | osm | class | type | name | addr+city | geometry |
356 | W1 | highway | primary | Wonderway | Right | 8,9 |
357 | N1 | amenity | cafe | Bolder | Left | 9 |
359 Then place_addressline contains
360 | object | address | isaddress |
363 And place_addressline doesn't contain
366 When sending search query "Bolder"
368 | osm | display_name |
369 | N1 | Bolder, Wonderway, Left |
371 Scenario: addr:* tags do not produce addresslines when the parent has the address part
377 | osm | class | type | admin | name | geometry |
378 | R1 | boundary | administrative | 8 | Outer | (1,5,6,4,1) |
380 | osm | class | type | name | addr+city | geometry |
381 | W1 | highway | primary | Wonderway | Outer | 8,9 |
382 | N1 | amenity | cafe | Bolder | Outer | 9 |
384 Then place_addressline contains
385 | object | address | isaddress |
387 And place_addressline doesn't contain
390 When sending search query "Bolder"
392 | osm | display_name |
393 | N1 | Bolder, Wonderway, Outer |
395 Scenario: addr:* tags on outside do not produce addresslines when the parent has the address part
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) |
405 | osm | class | type | name | addr+city | geometry |
406 | W1 | highway | primary | Wonderway | Left | 8,9 |
407 | N1 | amenity | cafe | Bolder | Left | 9 |
409 Then place_addressline contains
410 | object | address | isaddress |
413 And place_addressline doesn't contain
416 When sending search query "Bolder"
418 | osm | display_name |
419 | N1 | Bolder, Wonderway, Left |
421 Scenario: POIs can correct address parts on the fly
423 | 1 | | | | 2 | | 5 |
425 | 4 | | | | 3 | | 6 |
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) |
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 |
436 Then place_addressline contains
437 | object | address | isaddress |
440 And place_addressline doesn't contain
444 When sending search query "Bolder"
446 | osm | display_name |
447 | N1 | Bolder, Wonderway, Left |
448 When sending search query "Leftside"
450 | osm | display_name |
451 | N2 | Leftside, Wonderway, Right |
454 Scenario: POIs can correct address parts on the fly (with partial unmatching address)
456 | 1 | | | | 2 | | 5 |
458 | | 10| 11| | | 12| |
459 | 4 | | | | 3 | | 6 |
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) |
465 | osm | class | type | name | geometry |
466 | W1 | highway | primary | Wonderway | 10,11,12 |
468 | osm | class | type | name | addr+suburb | geometry |
469 | N1 | amenity | cafe | Bolder | Boring | 9 |
470 | N2 | amenity | cafe | Leftside | Boring | 8 |
472 Then place_addressline contains
473 | object | address | isaddress |
476 And place_addressline doesn't contain
480 When sending search query "Bolder"
482 | osm | display_name |
483 | N1 | Bolder, Wonderway, Left |
484 When sending search query "Leftside"
486 | osm | display_name |
487 | N2 | Leftside, Wonderway, Right |
491 Scenario: POIs can correct address parts on the fly (with partial matching address)
493 | 1 | | | | 2 | | 5 |
495 | | 10| 11| | | 12| |
496 | 4 | | | | 3 | | 6 |
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) |
502 | osm | class | type | name | geometry |
503 | W1 | highway | primary | Wonderway | 10,11,12 |
505 | osm | class | type | name | addr+state | geometry |
506 | N1 | amenity | cafe | Bolder | Left | 9 |
507 | N2 | amenity | cafe | Leftside | Left | 8 |
509 Then place_addressline contains
510 | object | address | isaddress |
513 And place_addressline doesn't contain
517 When sending search query "Bolder"
519 | osm | display_name |
520 | N1 | Bolder, Wonderway, Left |
521 When sending search query "Leftside"
523 | osm | display_name |
524 | N2 | Leftside, Wonderway, Left |
527 Scenario: addr:* tags always match the closer area
529 | 1 | | | | 2 | | 5 |
532 | 4 | | | | 3 | | 6 |
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) |
538 | osm | class | type | name | addr+city | geometry |
539 | W1 | highway | primary | Wonderway | Left | 10,11 |
541 Then place_addressline doesn't contain