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 prefered
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 scene admin-areas
258 | osm | class | type | admin | addr+postcode | geometry |
259 | R1 | boundary | administrative | 6 | 112 | :b0 |
260 | R34 | boundary | administrative | 8 | 112 DE | :b1:E |
261 | R4 | boundary | administrative | 10 | 112 DE 34 | :b2:N |
263 | osm | class | type | geometry |
264 | W93 | highway | residential | :w2N |
266 | osm | class | type | addr+postcode | geometry |
267 | W22 | place | postcode | 445023 | :building:w2N |
269 Then place_addressline doesn't contain
273 Scenario: postcode boundaries do appear in the address of a way
274 Given the scene admin-areas
276 | osm | class | type | admin | addr+postcode | geometry |
277 | R1 | boundary | administrative | 6 | 112 | :b0 |
278 | R34 | boundary | administrative | 8 | 112 DE | :b1:E |
280 | osm | class | type | addr+postcode | geometry |
281 | R4 | boundary | postal_code | 112 DE 34 | :b2:N |
283 | osm | class | type | geometry |
284 | W93 | highway | residential | :w2N |
286 | osm | class | type | addr+postcode | geometry |
287 | W22 | place | postcode | 445023 | :building:w2N |
289 Then place_addressline contains
293 Scenario: squares do not appear in the address of a street
299 | osm | class | type | geometry |
300 | W1 | highway | residential | 8, 9 |
301 | W2 | place | square | (1, 2, 3 ,4, 1) |
303 Then place_addressline doesn't contain
307 Scenario: addr:* tags are honored even when a street is far away from the place
313 | osm | class | type | admin | name | geometry |
314 | R1 | boundary | administrative | 8 | Left | (1,2,3,4,1) |
315 | R2 | boundary | administrative | 8 | Right | (2,3,6,5,2) |
317 | osm | class | type | addr+city | geometry |
318 | W1 | highway | primary | Left | 8,9 |
319 | W2 | highway | primary | Right | 8,9 |
321 Then place_addressline contains
322 | object | address | isaddress |
326 And place_addressline doesn't contain
331 Scenario: addr:* tags are honored even when a POI is far away from the place
337 | osm | class | type | admin | name | geometry |
338 | R1 | boundary | administrative | 8 | Left | (1,2,3,4,1) |
339 | R2 | boundary | administrative | 8 | Right | (2,3,6,5,2) |
341 | osm | class | type | name | addr+city | geometry |
342 | W1 | highway | primary | Wonderway | Right | 8,9 |
343 | N1 | amenity | cafe | Bolder | Left | 9 |
345 Then place_addressline contains
346 | object | address | isaddress |
349 And place_addressline doesn't contain
352 When sending search query "Bolder"
354 | osm | display_name |
355 | N1 | Bolder, Wonderway, Left |
357 Scenario: addr:* tags do not produce addresslines when the parent has the address part
363 | osm | class | type | admin | name | geometry |
364 | R1 | boundary | administrative | 8 | Outer | (1,5,6,4,1) |
366 | osm | class | type | name | addr+city | geometry |
367 | W1 | highway | primary | Wonderway | Outer | 8,9 |
368 | N1 | amenity | cafe | Bolder | Outer | 9 |
370 Then place_addressline contains
371 | object | address | isaddress |
373 And place_addressline doesn't contain
376 When sending search query "Bolder"
378 | osm | display_name |
379 | N1 | Bolder, Wonderway, Outer |
381 Scenario: addr:* tags on outside do not produce addresslines when the parent has the address part
387 | osm | class | type | admin | name | geometry |
388 | R1 | boundary | administrative | 8 | Left | (1,2,3,4,1) |
389 | R2 | boundary | administrative | 8 | Right | (2,3,6,5,2) |
391 | osm | class | type | name | addr+city | geometry |
392 | W1 | highway | primary | Wonderway | Left | 8,9 |
393 | N1 | amenity | cafe | Bolder | Left | 9 |
395 Then place_addressline contains
396 | object | address | isaddress |
399 And place_addressline doesn't contain
402 When sending search query "Bolder"
404 | osm | display_name |
405 | N1 | Bolder, Wonderway, Left |
407 Scenario: POIs can correct address parts on the fly
409 | 1 | | | | 2 | | 5 |
411 | 4 | | | | 3 | | 6 |
413 | osm | class | type | admin | name | geometry |
414 | R1 | boundary | administrative | 8 | Left | (1,2,3,4,1) |
415 | R2 | boundary | administrative | 8 | Right | (2,3,6,5,2) |
417 | osm | class | type | name | geometry |
418 | W1 | highway | primary | Wonderway | 2,3 |
419 | N1 | amenity | cafe | Bolder | 9 |
420 | N2 | amenity | cafe | Leftside | 8 |
422 Then place_addressline contains
423 | object | address | isaddress |
426 And place_addressline doesn't contain
430 When sending search query "Bolder"
432 | osm | display_name |
433 | N1 | Bolder, Wonderway, Left |
434 When sending search query "Leftside"
436 | osm | display_name |
437 | N2 | Leftside, Wonderway, Right |
440 Scenario: POIs can correct address parts on the fly (with partial unmatching address)
442 | 1 | | | | 2 | | 5 |
444 | | 10| 11| | | 12| |
445 | 4 | | | | 3 | | 6 |
447 | osm | class | type | admin | name | geometry |
448 | R1 | boundary | administrative | 8 | Left | (1,2,3,4,1) |
449 | R2 | boundary | administrative | 8 | Right | (2,3,6,5,2) |
451 | osm | class | type | name | geometry |
452 | W1 | highway | primary | Wonderway | 10,11,12 |
454 | osm | class | type | name | addr+suburb | geometry |
455 | N1 | amenity | cafe | Bolder | Boring | 9 |
456 | N2 | amenity | cafe | Leftside | Boring | 8 |
458 Then place_addressline contains
459 | object | address | isaddress |
462 And place_addressline doesn't contain
466 When sending search query "Bolder"
468 | osm | display_name |
469 | N1 | Bolder, Wonderway, Left |
470 When sending search query "Leftside"
472 | osm | display_name |
473 | N2 | Leftside, Wonderway, Right |
477 Scenario: POIs can correct address parts on the fly (with partial matching address)
479 | 1 | | | | 2 | | 5 |
481 | | 10| 11| | | 12| |
482 | 4 | | | | 3 | | 6 |
484 | osm | class | type | admin | name | geometry |
485 | R1 | boundary | administrative | 8 | Left | (1,2,3,4,1) |
486 | R2 | boundary | administrative | 8 | Right | (2,3,6,5,2) |
488 | osm | class | type | name | geometry |
489 | W1 | highway | primary | Wonderway | 10,11,12 |
491 | osm | class | type | name | addr+state | geometry |
492 | N1 | amenity | cafe | Bolder | Left | 9 |
493 | N2 | amenity | cafe | Leftside | Left | 8 |
495 Then place_addressline contains
496 | object | address | isaddress |
499 And place_addressline doesn't contain
503 When sending search query "Bolder"
505 | osm | display_name |
506 | N1 | Bolder, Wonderway, Left |
507 When sending search query "Leftside"
509 | osm | display_name |
510 | N2 | Leftside, Wonderway, Left |
513 Scenario: addr:* tags always match the closer area
515 | 1 | | | | 2 | | 5 |
518 | 4 | | | | 3 | | 6 |
520 | osm | class | type | admin | name | geometry |
521 | R1 | boundary | administrative | 8 | Left | (1,2,3,4,1) |
522 | R2 | boundary | administrative | 8 | Left | (2,3,6,5,2) |
524 | osm | class | type | name | addr+city | geometry |
525 | W1 | highway | primary | Wonderway | Left | 10,11 |
527 Then place_addressline doesn't contain