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: squares do not appear in the address of a street
277 | osm | class | type | geometry |
278 | W1 | highway | residential | 8, 9 |
279 | W2 | place | square | (1, 2, 3 ,4, 1) |
281 Then place_addressline contains exactly
284 Scenario: addr:* tags are honored even when a street is far away from the place
290 | osm | class | type | admin | name | geometry |
291 | R1 | boundary | administrative | 8 | Left | (1,2,3,4,1) |
292 | R2 | boundary | administrative | 8 | Right | (2,3,6,5,2) |
294 | osm | class | type | addr+city | geometry |
295 | W1 | highway | primary | Left | 8,9 |
296 | W2 | highway | primary | Right | 8,9 |
298 Then place_addressline contains exactly
299 | object | address | isaddress |
305 Scenario: addr:* tags are honored even when a POI 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 | name | addr+city | geometry |
316 | W1 | highway | primary | Wonderway | Right | 8,9 |
317 | N1 | amenity | cafe | Bolder | Left | 9 |
319 Then place_addressline contains exactly
320 | object | address | isaddress |
323 When geocoding "Bolder"
324 Then the result set contains
325 | object | display_name |
326 | N1 | Bolder, Wonderway, Left |
328 Scenario: addr:* tags do not produce addresslines when the parent has the address part
334 | osm | class | type | admin | name | geometry |
335 | R1 | boundary | administrative | 8 | Outer | (1,5,6,4,1) |
337 | osm | class | type | name | addr+city | geometry |
338 | W1 | highway | primary | Wonderway | Outer | 8,9 |
339 | N1 | amenity | cafe | Bolder | Outer | 9 |
341 Then place_addressline contains exactly
342 | object | address | isaddress |
344 When geocoding "Bolder"
345 Then the result set contains
346 | object | display_name |
347 | N1 | Bolder, Wonderway, Outer |
349 Scenario: addr:* tags on outside do not produce addresslines when the parent has the address part
355 | osm | class | type | admin | name | geometry |
356 | R1 | boundary | administrative | 8 | Left | (1,2,3,4,1) |
357 | R2 | boundary | administrative | 8 | Right | (2,3,6,5,2) |
359 | osm | class | type | name | addr+city | geometry |
360 | W1 | highway | primary | Wonderway | Left | 8,9 |
361 | N1 | amenity | cafe | Bolder | Left | 9 |
363 Then place_addressline contains exactly
364 | object | address | isaddress |
367 When geocoding "Bolder"
368 Then the result set contains
369 | object | display_name |
370 | N1 | Bolder, Wonderway, Left |
372 Scenario: POIs can correct address parts on the fly
374 | 1 | | | | 2 | | 5 |
376 | 4 | | | | 3 | | 6 |
378 | osm | class | type | admin | name | geometry |
379 | R1 | boundary | administrative | 8 | Left | (1,2,3,4,1) |
380 | R2 | boundary | administrative | 8 | Right | (2,3,6,5,2) |
382 | osm | class | type | name | geometry |
383 | W1 | highway | primary | Wonderway | 2,3 |
384 | N1 | amenity | cafe | Bolder | 9 |
385 | N2 | amenity | cafe | Leftside | 8 |
387 Then place_addressline contains exactly
388 | object | address | isaddress |
391 When geocoding "Bolder"
392 Then the result set contains
393 | object | display_name |
394 | N1 | Bolder, Wonderway, Left |
395 When geocoding "Leftside"
396 Then the result set contains
397 | object | display_name |
398 | N2 | Leftside, Wonderway, Right |
401 Scenario: POIs can correct address parts on the fly (with partial unmatching address)
403 | 1 | | | | 2 | | 5 |
405 | | 10| 11| | | 12| |
406 | 4 | | | | 3 | | 6 |
408 | osm | class | type | admin | name | geometry |
409 | R1 | boundary | administrative | 8 | Left | (1,2,3,4,1) |
410 | R2 | boundary | administrative | 8 | Right | (2,3,6,5,2) |
412 | osm | class | type | name | geometry |
413 | W1 | highway | primary | Wonderway | 10,11,12 |
415 | osm | class | type | name | addr+suburb | geometry |
416 | N1 | amenity | cafe | Bolder | Boring | 9 |
417 | N2 | amenity | cafe | Leftside | Boring | 8 |
419 Then place_addressline contains exactly
420 | object | address | isaddress |
423 When geocoding "Bolder"
424 Then the result set contains
425 | object | display_name |
426 | N1 | Bolder, Wonderway, Left |
427 When geocoding "Leftside"
428 Then the result set contains
429 | object | display_name |
430 | N2 | Leftside, Wonderway, Right |
434 Scenario: POIs can correct address parts on the fly (with partial matching address)
436 | 1 | | | | 2 | | 5 |
438 | | 10| 11| | | 12| |
439 | 4 | | | | 3 | | 6 |
441 | osm | class | type | admin | name | geometry |
442 | R1 | boundary | administrative | 8 | Left | (1,2,3,4,1) |
443 | R2 | boundary | administrative | 8 | Right | (2,3,6,5,2) |
445 | osm | class | type | name | geometry |
446 | W1 | highway | primary | Wonderway | 10,11,12 |
448 | osm | class | type | name | addr+state | geometry |
449 | N1 | amenity | cafe | Bolder | Left | 9 |
450 | N2 | amenity | cafe | Leftside | Left | 8 |
452 Then place_addressline contains exactly
453 | object | address | isaddress |
456 When geocoding "Bolder"
457 Then the result set contains
458 | object | display_name |
459 | N1 | Bolder, Wonderway, Left |
460 When geocoding "Leftside"
461 Then the result set contains
462 | object | display_name |
463 | N2 | Leftside, Wonderway, Left |
466 Scenario: addr:* tags always match the closer area
468 | 1 | | | | 2 | | 5 |
470 | 4 | | | | 3 | | 6 |
473 | osm | class | type | admin | name | geometry |
474 | R1 | boundary | administrative | 8 | Left | (1,2,3,4,1) |
475 | R2 | boundary | administrative | 8 | Left | (2,3,6,5,2) |
477 | osm | class | type | name | addr+city | geometry |
478 | W1 | highway | primary | Wonderway | Left | 10,11 |
480 Then place_addressline contains exactly
484 Scenario: Full name is prefered for unlisted addr:place tags
489 | osm | class | type | name | geometry |
490 | W10 | place | city | Away | (8,1,2,9,8) |
492 | osm | class | type | name | addr+city | geometry |
493 | W1 | highway | residential | Royal Terrace | Gardens | 8,9 |
495 | osm | class | type | housenr | addr+place | geometry | extra+foo |
496 | N1 | place | house | 1 | Royal Terrace Gardens | 1 | bar |
498 | osm | class | type | housenr | addr+street | geometry |
499 | N2 | place | house | 2 | Royal Terrace | 2 |
501 When geocoding "1, Royal Terrace Gardens"
502 Then result 0 contains