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
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) |
87 Then place_addressline contains
88 | object | address | isaddress | cached_rank_address |
89 | N1 | R1 | True | 16 |
90 | N1 | N2 | False | 16 |
92 Scenario: place nodes outside a smaller ranked area are ignored
98 | osm | class | type | admin | geometry |
99 | N1 | place | square | 15 | 7 |
100 | N2 | place | city | 15 | 9 |
101 | R1 | place | city | 8 | (1,2,3,4,1) |
103 Then place_addressline contains
104 | object | address | isaddress | cached_rank_address |
105 | N1 | R1 | True | 16 |
106 And place_addressline doesn't contain
111 Scenario: place nodes close enough to smaller ranked place nodes are included
115 | osm | class | type | geometry |
116 | N1 | place | square | 1 |
117 | N2 | place | hamlet | 2 |
118 | N3 | place | quarter | 3 |
120 Then place_addressline contains
121 | object | address | fromarea | isaddress |
122 | N1 | N2 | False | True |
123 | N1 | N3 | False | True |
126 Scenario: place nodes too far away from a smaller ranked place nodes are marked non-address
130 | osm | class | type | geometry |
131 | N1 | place | square | 1 |
132 | N2 | place | hamlet | 2 |
133 | N3 | place | quarter | 3 |
135 Then place_addressline contains
136 | object | address | fromarea | isaddress |
137 | N1 | N2 | False | True |
138 | N1 | N3 | False | False |
142 Scenario: Roads crossing boundaries should contain both states
148 | osm | class | type | geometry |
149 | W1 | highway | road | 7, 8 |
151 | osm | class | type | admin | geometry |
152 | W10 | boundary | administrative | 5 | (1, 2, 5, 4, 1) |
153 | W11 | boundary | administrative | 5 | (2, 3, 6, 5, 2) |
155 Then place_addressline contains
156 | object | address | cached_rank_address |
161 Scenario: Roads following a boundary should contain both states
167 | osm | class | type | geometry |
168 | W1 | highway | road | 2, 7, 8 |
170 | osm | class | type | admin | geometry |
171 | W10 | boundary | administrative | 5 | (1, 2, 5, 4, 1) |
172 | W11 | boundary | administrative | 5 | (2, 3, 6, 5, 2) |
174 Then place_addressline contains
175 | object | address | cached_rank_address |
179 Scenario: Roads should not contain boundaries they touch in a end point
185 | osm | class | type | geometry |
186 | W1 | highway | road | 7, 8 |
188 | osm | class | type | admin | geometry |
189 | W10 | boundary | administrative | 5 | (1, 2, 8, 5, 4, 1) |
190 | W11 | boundary | administrative | 5 | (2, 3, 6, 5, 8, 2) |
192 Then place_addressline contains
193 | object | address | cached_rank_address |
195 Then place_addressline doesn't contain
199 Scenario: Roads should not contain boundaries they touch in a middle point
203 | 4 | | 9 | 5 | | 6 |
205 | osm | class | type | geometry |
206 | W1 | highway | road | 7, 8, 9 |
208 | osm | class | type | admin | geometry |
209 | W10 | boundary | administrative | 5 | (1, 2, 8, 5, 4, 1) |
210 | W11 | boundary | administrative | 5 | (2, 3, 6, 5, 8, 2) |
212 Then place_addressline contains
213 | object | address | cached_rank_address |
215 Then place_addressline doesn't contain
219 Scenario: Locality points should contain all boundaries they touch
225 | osm | class | type | geometry |
226 | N1 | place | locality | 8 |
228 | osm | class | type | admin | geometry |
229 | W10 | boundary | administrative | 5 | (1, 2, 8, 5, 4, 1) |
230 | W11 | boundary | administrative | 5 | (2, 3, 6, 5, 8, 2) |
232 Then place_addressline contains
233 | object | address | cached_rank_address |
237 Scenario: Areas should not contain boundaries they touch
243 | osm | class | type | geometry |
244 | W1 | landuse | industrial | (1, 2, 5, 4, 1) |
246 | osm | class | type | admin | geometry |
247 | W10 | boundary | administrative | 5 | (2, 3, 6, 5, 2) |
249 Then place_addressline doesn't contain
253 Scenario: buildings with only addr:postcodes do not appear in the address of a way
254 Given the scene admin-areas
256 | osm | class | type | admin | addr+postcode | geometry |
257 | R1 | boundary | administrative | 6 | 112 | :b0 |
258 | R34 | boundary | administrative | 8 | 112 DE | :b1:E |
259 | R4 | boundary | administrative | 10 | 112 DE 34 | :b2:N |
261 | osm | class | type | geometry |
262 | W93 | highway | residential | :w2N |
264 | osm | class | type | addr+postcode | geometry |
265 | W22 | place | postcode | 445023 | :building:w2N |
267 Then place_addressline doesn't contain
271 Scenario: postcode boundaries do appear in the address of a way
272 Given the scene admin-areas
274 | osm | class | type | admin | addr+postcode | geometry |
275 | R1 | boundary | administrative | 6 | 112 | :b0 |
276 | R34 | boundary | administrative | 8 | 112 DE | :b1:E |
278 | osm | class | type | addr+postcode | geometry |
279 | R4 | boundary | postal_code | 112 DE 34 | :b2:N |
281 | osm | class | type | geometry |
282 | W93 | highway | residential | :w2N |
284 | osm | class | type | addr+postcode | geometry |
285 | W22 | place | postcode | 445023 | :building:w2N |
287 Then place_addressline contains
291 Scenario: squares do not appear in the address of a street
297 | osm | class | type | geometry |
298 | W1 | highway | residential | 8, 9 |
299 | W2 | place | square | (1, 2, 3 ,4, 1) |
301 Then place_addressline doesn't contain
305 Scenario: addr:* tags are honored even when a street is far away from the place
311 | osm | class | type | admin | name | geometry |
312 | R1 | boundary | administrative | 8 | Left | (1,2,3,4,1) |
313 | R2 | boundary | administrative | 8 | Right | (2,3,6,5,2) |
315 | osm | class | type | addr+city | geometry |
316 | W1 | highway | primary | Left | 8,9 |
317 | W2 | highway | primary | Right | 8,9 |
319 Then place_addressline contains
320 | object | address | isaddress |
324 And place_addressline doesn't contain
329 Scenario: addr:* tags are honored even when a POI is far away from the place
335 | osm | class | type | admin | name | geometry |
336 | R1 | boundary | administrative | 8 | Left | (1,2,3,4,1) |
337 | R2 | boundary | administrative | 8 | Right | (2,3,6,5,2) |
339 | osm | class | type | name | addr+city | geometry |
340 | W1 | highway | primary | Wonderway | Right | 8,9 |
341 | N1 | amenity | cafe | Bolder | Left | 9 |
343 Then place_addressline contains
344 | object | address | isaddress |
347 And place_addressline doesn't contain
350 When sending search query "Bolder"
352 | osm | display_name |
353 | N1 | Bolder, Wonderway, Left |
355 Scenario: addr:* tags do not produce addresslines when the parent has the address part
361 | osm | class | type | admin | name | geometry |
362 | R1 | boundary | administrative | 8 | Outer | (1,5,6,4,1) |
364 | osm | class | type | name | addr+city | geometry |
365 | W1 | highway | primary | Wonderway | Outer | 8,9 |
366 | N1 | amenity | cafe | Bolder | Outer | 9 |
368 Then place_addressline contains
369 | object | address | isaddress |
371 And place_addressline doesn't contain
374 When sending search query "Bolder"
376 | osm | display_name |
377 | N1 | Bolder, Wonderway, Outer |
379 Scenario: addr:* tags on outside do not produce addresslines when the parent has the address part
385 | osm | class | type | admin | name | geometry |
386 | R1 | boundary | administrative | 8 | Left | (1,2,3,4,1) |
387 | R2 | boundary | administrative | 8 | Right | (2,3,6,5,2) |
389 | osm | class | type | name | addr+city | geometry |
390 | W1 | highway | primary | Wonderway | Left | 8,9 |
391 | N1 | amenity | cafe | Bolder | Left | 9 |
393 Then place_addressline contains
394 | object | address | isaddress |
397 And place_addressline doesn't contain
400 When sending search query "Bolder"
402 | osm | display_name |
403 | N1 | Bolder, Wonderway, Left |
405 Scenario: POIs can correct address parts on the fly
407 | 1 | | | | 2 | | 5 |
409 | 4 | | | | 3 | | 6 |
411 | osm | class | type | admin | name | geometry |
412 | R1 | boundary | administrative | 8 | Left | (1,2,3,4,1) |
413 | R2 | boundary | administrative | 8 | Right | (2,3,6,5,2) |
415 | osm | class | type | name | geometry |
416 | W1 | highway | primary | Wonderway | 2,3 |
417 | N1 | amenity | cafe | Bolder | 9 |
418 | N2 | amenity | cafe | Leftside | 8 |
420 Then place_addressline contains
421 | object | address | isaddress |
424 And place_addressline doesn't contain
428 When sending search query "Bolder"
430 | osm | display_name |
431 | N1 | Bolder, Wonderway, Left |
432 When sending search query "Leftside"
434 | osm | display_name |
435 | N2 | Leftside, Wonderway, Right |
438 Scenario: POIs can correct address parts on the fly (with partial unmatching address)
440 | 1 | | | | 2 | | 5 |
442 | | 10| 11| | | 12| |
443 | 4 | | | | 3 | | 6 |
445 | osm | class | type | admin | name | geometry |
446 | R1 | boundary | administrative | 8 | Left | (1,2,3,4,1) |
447 | R2 | boundary | administrative | 8 | Right | (2,3,6,5,2) |
449 | osm | class | type | name | geometry |
450 | W1 | highway | primary | Wonderway | 10,11,12 |
452 | osm | class | type | name | addr+suburb | geometry |
453 | N1 | amenity | cafe | Bolder | Boring | 9 |
454 | N2 | amenity | cafe | Leftside | Boring | 8 |
456 Then place_addressline contains
457 | object | address | isaddress |
460 And place_addressline doesn't contain
464 When sending search query "Bolder"
466 | osm | display_name |
467 | N1 | Bolder, Wonderway, Left |
468 When sending search query "Leftside"
470 | osm | display_name |
471 | N2 | Leftside, Wonderway, Right |
475 Scenario: POIs can correct address parts on the fly (with partial matching address)
477 | 1 | | | | 2 | | 5 |
479 | | 10| 11| | | 12| |
480 | 4 | | | | 3 | | 6 |
482 | osm | class | type | admin | name | geometry |
483 | R1 | boundary | administrative | 8 | Left | (1,2,3,4,1) |
484 | R2 | boundary | administrative | 8 | Right | (2,3,6,5,2) |
486 | osm | class | type | name | geometry |
487 | W1 | highway | primary | Wonderway | 10,11,12 |
489 | osm | class | type | name | addr+state | geometry |
490 | N1 | amenity | cafe | Bolder | Left | 9 |
491 | N2 | amenity | cafe | Leftside | Left | 8 |
493 Then place_addressline contains
494 | object | address | isaddress |
497 And place_addressline doesn't contain
501 When sending search query "Bolder"
503 | osm | display_name |
504 | N1 | Bolder, Wonderway, Left |
505 When sending search query "Leftside"
507 | osm | display_name |
508 | N2 | Leftside, Wonderway, Left |
511 Scenario: addr:* tags always match the closer area
513 | 1 | | | | 2 | | 5 |
516 | 4 | | | | 3 | | 6 |
518 | osm | class | type | admin | name | geometry |
519 | R1 | boundary | administrative | 8 | Left | (1,2,3,4,1) |
520 | R2 | boundary | administrative | 8 | Left | (2,3,6,5,2) |
522 | osm | class | type | name | addr+city | geometry |
523 | W1 | highway | primary | Wonderway | Left | 10,11 |
525 Then place_addressline doesn't contain