1 Feature: Address computation
2 Tests for filling of place_addressline
4 Scenario: place nodes are added to the address when they are close enough
6 | 2 | | | | | | 1 | | 3 |
8 | osm | class | type | name | geometry |
9 | N1 | place | square | Square | 1 |
10 | N2 | place | hamlet | West Farm | 2 |
11 | N3 | place | hamlet | East Farm | 3 |
13 Then place_addressline contains exactly
14 | object | address | fromarea |
16 When geocoding "Square"
17 Then the result set contains
18 | object | display_name |
19 | N1 | Square, East Farm |
21 Scenario: given two place nodes, the closer one wins for the address
25 | osm | class | type | geometry |
26 | N1 | place | square | 1 |
27 | N2 | place | hamlet | 2 |
28 | N3 | place | hamlet | 3 |
30 Then place_addressline contains
31 | object | address | fromarea | isaddress |
32 | N1 | N3 | False | True |
33 | N1 | N2 | False | False |
35 Scenario: boundaries around the place are added to the address
37 | 1 | | 4 | | 7 | 10 |
38 | 2 | | 5 | | 8 | 11 |
45 | osm | class | type | admin | geometry |
46 | R1 | boundary | administrative | 3 | (1,2,3,12,11,10,7,8,9,6,5,4,1) |
47 | R2 | boundary | administrative | 4 | (2,3,12,11,8,9,6,5,2) |
48 | N1 | place | square | 15 | 99 |
50 Then place_addressline contains
51 | object | address | isaddress |
55 Scenario: with boundaries of same rank the one with the closer centroid is preferred
61 | osm | class | type | admin | geometry |
62 | R1 | boundary | administrative | 8 | (1,2,4,3,1) |
63 | R2 | boundary | administrative | 8 | (1,2,6,5,1) |
64 | N1 | place | square | 15 | 9 |
66 Then place_addressline contains
67 | object | address | isaddress |
71 Scenario: boundary areas are preferred over place nodes in the address
73 | 1 | | | | 10 | | 3 |
76 | 2 | | | | 11 | | 4 |
78 | osm | class | type | admin | geometry |
79 | N1 | place | square | 15 | 5 |
80 | N2 | place | city | 15 | 6 |
81 | R1 | place | city | 8 | (1,2,4,3,1) |
82 | R2 | boundary | administrative | 9 | (1,10,11,2,1) |
84 Then place_addressline contains
85 | object | address | isaddress | cached_rank_address |
86 | N1 | R1 | True | 16 |
87 | N1 | R2 | True | 18 |
88 | N1 | N2 | False | 18 |
90 Scenario: place nodes outside a smaller ranked area are ignored
96 | osm | class | type | admin | geometry |
97 | N1 | place | square | 15 | 7 |
98 | N2 | place | city | 15 | 9 |
99 | R1 | place | city | 8 | (1,2,3,4,1) |
101 Then place_addressline contains exactly
102 | object | address | isaddress | cached_rank_address |
103 | N1 | R1 | True | 16 |
106 Scenario: place nodes close enough to smaller ranked place nodes are included
110 | osm | class | type | geometry |
111 | N1 | place | square | 1 |
112 | N2 | place | hamlet | 2 |
113 | N3 | place | quarter | 3 |
115 Then place_addressline contains
116 | object | address | fromarea | isaddress |
117 | N1 | N2 | False | True |
118 | N1 | N3 | False | True |
121 Scenario: place nodes too far away from a smaller ranked place nodes are marked non-address
125 | osm | class | type | geometry |
126 | N1 | place | square | 1 |
127 | N2 | place | hamlet | 2 |
128 | N3 | place | quarter | 3 |
130 Then place_addressline contains
131 | object | address | fromarea | isaddress |
132 | N1 | N2 | False | True |
133 | N1 | N3 | False | False |
137 Scenario: Roads crossing boundaries should contain both states
143 | osm | class | type | geometry |
144 | W1 | highway | road | 7, 8 |
146 | osm | class | type | admin | geometry |
147 | W10 | boundary | administrative | 5 | (1, 2, 5, 4, 1) |
148 | W11 | boundary | administrative | 5 | (2, 3, 6, 5, 2) |
150 Then place_addressline contains
151 | object | address | cached_rank_address |
156 Scenario: Roads following a boundary should contain both states
162 | osm | class | type | geometry |
163 | W1 | highway | road | 2, 7, 8 |
165 | osm | class | type | admin | geometry |
166 | W10 | boundary | administrative | 5 | (1, 2, 5, 4, 1) |
167 | W11 | boundary | administrative | 5 | (2, 3, 6, 5, 2) |
169 Then place_addressline contains
170 | object | address | cached_rank_address |
174 Scenario: Roads should not contain boundaries they touch in a end point
180 | osm | class | type | geometry |
181 | W1 | highway | road | 7, 8 |
183 | osm | class | type | admin | geometry |
184 | W10 | boundary | administrative | 5 | (1, 2, 8, 5, 4, 1) |
185 | W11 | boundary | administrative | 5 | (2, 3, 6, 5, 8, 2) |
187 Then place_addressline contains exactly
188 | object | address | cached_rank_address |
191 Scenario: Roads should not contain boundaries they touch in a middle point
195 | 4 | | 9 | 5 | | 6 |
197 | osm | class | type | geometry |
198 | W1 | highway | road | 7, 8, 9 |
200 | osm | class | type | admin | geometry |
201 | W10 | boundary | administrative | 5 | (1, 2, 8, 5, 4, 1) |
202 | W11 | boundary | administrative | 5 | (2, 3, 6, 5, 8, 2) |
204 Then place_addressline contains exactly
205 | object | address | cached_rank_address |
208 Scenario: Locality points should contain all boundaries they touch
214 | osm | class | type | geometry |
215 | N1 | place | locality | 8 |
217 | osm | class | type | admin | geometry |
218 | W10 | boundary | administrative | 5 | (1, 2, 8, 5, 4, 1) |
219 | W11 | boundary | administrative | 5 | (2, 3, 6, 5, 8, 2) |
221 Then place_addressline contains
222 | object | address | cached_rank_address |
226 Scenario: Areas should not contain boundaries they touch
232 | osm | class | type | geometry |
233 | W1 | landuse | industrial | (1, 2, 5, 4, 1) |
235 | osm | class | type | admin | geometry |
236 | W10 | boundary | administrative | 5 | (2, 3, 6, 5, 2) |
238 Then place_addressline contains exactly
241 Scenario: buildings with only addr:postcodes do not appear in the address of a way
242 Given the grid with origin DE
243 | 1 | | | | | 8 | | 6 | | 2 |
244 | |10 |11 | | | | | | | |
245 | |13 |12 | | | | | | | |
246 | 20| | | 21| | | | | | |
247 | | | | | | | | | | |
248 | | | | | | 9 | | | | |
249 | 4 | | | | | | | 7 | | 3 |
251 | osm | class | type | admin | addr+postcode | geometry |
252 | R1 | boundary | administrative | 6 | 10000 | (1,2,3,4,1)|
253 | R34 | boundary | administrative | 8 | 11200 | (1,6,7,4,1)|
254 | R4 | boundary | administrative | 10 | 11230 | (1,8,9,4,1)|
256 | osm | class | type | geometry |
257 | W93 | highway | residential | 20,21 |
259 | osm | class | type | addr+postcode | geometry |
260 | W22 | place | postcode | 11234 | (10,11,12,13,10) |
262 Then place_addressline contains exactly
271 Scenario: postcode boundaries do appear in the address of a way
272 Given the grid with origin DE
273 | 1 | | | | | 8 | | 6 | | 2 |
274 | |10 |11 | | | | | | | |
275 | |13 |12 | | | | | | | |
276 | 20| | | 21| | | | | | |
277 | | | | | | | | | | |
278 | | | | | | 9 | | | | |
279 | 4 | | | | | | | 7 | | 3 |
281 | osm | class | type | admin | addr+postcode | geometry |
282 | R1 | boundary | administrative | 6 | 10000 | (1,2,3,4,1) |
283 | R34 | boundary | administrative | 8 | 11000 | (1,6,7,4,1) |
285 | osm | class | type | addr+postcode | geometry |
286 | R4 | boundary | postal_code | 11200 | (1,8,9,4,1) |
288 | osm | class | type | geometry |
289 | W93 | highway | residential | 20,21 |
291 | osm | class | type | addr+postcode | geometry |
292 | W22 | place | postcode | 11234 | (10,11,12,13,10) |
294 Then place_addressline contains
298 Scenario: squares do not appear in the address of a street
304 | osm | class | type | geometry |
305 | W1 | highway | residential | 8, 9 |
306 | W2 | place | square | (1, 2, 3 ,4, 1) |
308 Then place_addressline contains exactly
311 Scenario: addr:* tags are honored even when a street is far away from the place
317 | osm | class | type | admin | name | geometry |
318 | R1 | boundary | administrative | 8 | Left | (1,2,3,4,1) |
319 | R2 | boundary | administrative | 8 | Right | (2,3,6,5,2) |
321 | osm | class | type | addr+city | geometry |
322 | W1 | highway | primary | Left | 8,9 |
323 | W2 | highway | primary | Right | 8,9 |
325 Then place_addressline contains exactly
326 | object | address | isaddress |
332 Scenario: addr:* tags are honored even when a POI is far away from the place
338 | osm | class | type | admin | name | geometry |
339 | R1 | boundary | administrative | 8 | Left | (1,2,3,4,1) |
340 | R2 | boundary | administrative | 8 | Right | (2,3,6,5,2) |
342 | osm | class | type | name | addr+city | geometry |
343 | W1 | highway | primary | Wonderway | Right | 8,9 |
344 | N1 | amenity | cafe | Bolder | Left | 9 |
346 Then place_addressline contains exactly
347 | object | address | isaddress |
350 When geocoding "Bolder"
351 Then the result set contains
352 | object | 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 exactly
369 | object | address | isaddress |
371 When geocoding "Bolder"
372 Then the result set contains
373 | object | display_name |
374 | N1 | Bolder, Wonderway, Outer |
376 Scenario: addr:* tags on outside do not produce addresslines when the parent has the address part
382 | osm | class | type | admin | name | geometry |
383 | R1 | boundary | administrative | 8 | Left | (1,2,3,4,1) |
384 | R2 | boundary | administrative | 8 | Right | (2,3,6,5,2) |
386 | osm | class | type | name | addr+city | geometry |
387 | W1 | highway | primary | Wonderway | Left | 8,9 |
388 | N1 | amenity | cafe | Bolder | Left | 9 |
390 Then place_addressline contains exactly
391 | object | address | isaddress |
394 When geocoding "Bolder"
395 Then the result set contains
396 | object | display_name |
397 | N1 | Bolder, Wonderway, Left |
399 Scenario: POIs can correct address parts on the fly
401 | 1 | | | | 2 | | 5 |
403 | 4 | | | | 3 | | 6 |
405 | osm | class | type | admin | name | geometry |
406 | R1 | boundary | administrative | 8 | Left | (1,2,3,4,1) |
407 | R2 | boundary | administrative | 8 | Right | (2,3,6,5,2) |
409 | osm | class | type | name | geometry |
410 | W1 | highway | primary | Wonderway | 2,3 |
411 | N1 | amenity | cafe | Bolder | 9 |
412 | N2 | amenity | cafe | Leftside | 8 |
414 Then place_addressline contains exactly
415 | object | address | isaddress |
418 When geocoding "Bolder"
419 Then the result set contains
420 | object | display_name |
421 | N1 | Bolder, Wonderway, Left |
422 When geocoding "Leftside"
423 Then the result set contains
424 | object | display_name |
425 | N2 | Leftside, Wonderway, Right |
428 Scenario: POIs can correct address parts on the fly (with partial unmatching address)
430 | 1 | | | | 2 | | 5 |
432 | | 10| 11| | | 12| |
433 | 4 | | | | 3 | | 6 |
435 | osm | class | type | admin | name | geometry |
436 | R1 | boundary | administrative | 8 | Left | (1,2,3,4,1) |
437 | R2 | boundary | administrative | 8 | Right | (2,3,6,5,2) |
439 | osm | class | type | name | geometry |
440 | W1 | highway | primary | Wonderway | 10,11,12 |
442 | osm | class | type | name | addr+suburb | geometry |
443 | N1 | amenity | cafe | Bolder | Boring | 9 |
444 | N2 | amenity | cafe | Leftside | Boring | 8 |
446 Then place_addressline contains exactly
447 | object | address | isaddress |
450 When geocoding "Bolder"
451 Then the result set contains
452 | object | display_name |
453 | N1 | Bolder, Wonderway, Left |
454 When geocoding "Leftside"
455 Then the result set contains
456 | object | display_name |
457 | N2 | Leftside, Wonderway, Right |
461 Scenario: POIs can correct address parts on the fly (with partial matching address)
463 | 1 | | | | 2 | | 5 |
465 | | 10| 11| | | 12| |
466 | 4 | | | | 3 | | 6 |
468 | osm | class | type | admin | name | geometry |
469 | R1 | boundary | administrative | 8 | Left | (1,2,3,4,1) |
470 | R2 | boundary | administrative | 8 | Right | (2,3,6,5,2) |
472 | osm | class | type | name | geometry |
473 | W1 | highway | primary | Wonderway | 10,11,12 |
475 | osm | class | type | name | addr+state | geometry |
476 | N1 | amenity | cafe | Bolder | Left | 9 |
477 | N2 | amenity | cafe | Leftside | Left | 8 |
479 Then place_addressline contains exactly
480 | object | address | isaddress |
483 When geocoding "Bolder"
484 Then the result set contains
485 | object | display_name |
486 | N1 | Bolder, Wonderway, Left |
487 When geocoding "Leftside"
488 Then the result set contains
489 | object | display_name |
490 | N2 | Leftside, Wonderway, Left |
493 Scenario: addr:* tags always match the closer area
495 | 1 | | | | 2 | | 5 |
497 | 4 | | | | 3 | | 6 |
500 | osm | class | type | admin | name | geometry |
501 | R1 | boundary | administrative | 8 | Left | (1,2,3,4,1) |
502 | R2 | boundary | administrative | 8 | Left | (2,3,6,5,2) |
504 | osm | class | type | name | addr+city | geometry |
505 | W1 | highway | primary | Wonderway | Left | 10,11 |
507 Then place_addressline contains exactly
511 Scenario: Full name is prefered for unlisted addr:place tags
516 | osm | class | type | name | geometry |
517 | W10 | place | city | Away | (8,1,2,9,8) |
519 | osm | class | type | name | addr+city | geometry |
520 | W1 | highway | residential | Royal Terrace | Gardens | 8,9 |
522 | osm | class | type | housenr | addr+place | geometry | extra+foo |
523 | N1 | place | house | 1 | Royal Terrace Gardens | 1 | bar |
525 | osm | class | type | housenr | addr+street | geometry |
526 | N2 | place | house | 2 | Royal Terrace | 2 |
528 When geocoding "1, Royal Terrace Gardens"
529 Then result 0 contains