1 Feature: Rank assignment
2 Tests for assignment of search and address ranks.
4 Scenario: Ranks for place nodes are assigned according to their type
6 | osm | class | type | geometry |
7 | N1 | foo | bar | 0 0 |
8 | N11 | place | Continent | 0 0 |
9 | N12 | place | continent | 0 0 |
10 | N13 | place | sea | 0 0 |
11 | N14 | place | country | 0 0 |
12 | N15 | place | state | 0 0 |
13 | N16 | place | region | 0 0 |
14 | N17 | place | county | 0 0 |
15 | N18 | place | city | 0 0 |
16 | N19 | place | island | 0 0 |
17 | N36 | place | house | 0 0 |
19 | osm | class | type | extra+capital | geometry |
20 | N101 | place | city | yes | 0 0 |
23 | object | rank_search | rank_address |
37 Scenario: Ranks for boundaries are assigned according to admin level
38 Given the named places
39 | osm | class | type | admin | geometry |
40 | R20 | boundary | administrative | 2 | (1 1, 2 2, 1 2, 1 1) |
41 | R21 | boundary | administrative | 32 | (3 3, 4 4, 3 4, 3 3) |
42 | R22 | boundary | administrative | 6 | (0 0, 1 0, 0 1, 0 0) |
43 | R23 | boundary | administrative | 10 | (0 0, 1 1, 1 0, 0 0) |
46 | object | rank_search | rank_address |
52 Scenario: Ranks for addressable boundaries with place assignment go with place address ranks if available
53 Given the named places
54 | osm | class | type | admin | extra+place | geometry |
55 | R20 | boundary | administrative | 3 | state | (1 1, 2 2, 1 2, 1 1) |
56 | R21 | boundary | administrative | 32 | suburb | (3 3, 4 4, 3 4, 3 3) |
57 | R22 | boundary | administrative | 6 | town | (0 0, 1 0, 0 1, 0 0) |
58 | R23 | boundary | administrative | 10 | village | (0 0, 1 1, 1 0, 0 0) |
61 | object | rank_search | rank_address |
67 Scenario: Place address ranks cannot overtake a parent address rank
68 Given the named places
69 | osm | class | type | admin | extra+place | geometry |
70 | R20 | boundary | administrative | 8 | town | (0 0, 0 2, 2 2, 2 0, 0 0) |
71 | R21 | boundary | administrative | 9 | municipality | (0 0, 0 1, 1 1, 1 0, 0 0) |
72 | R22 | boundary | administrative | 9 | suburb | (0 0, 0 1, 1 1, 1 0, 0 0) |
75 | object | rank_search | rank_address |
79 Then place_addressline contains
80 | object | address | cached_rank_address |
84 Scenario: Admin levels cannot overtake each other due to place address ranks
85 Given the named places
86 | osm | class | type | admin | extra+place | geometry |
87 | R20 | boundary | administrative | 6 | town | (0 0, 0 2, 2 2, 2 0, 0 0) |
88 | R21 | boundary | administrative | 8 | | (0 0, 0 1, 1 1, 1 0, 0 0) |
89 | R22 | boundary | administrative | 8 | suburb | (0 0, 0 1, 1 1, 1 0, 0 0) |
92 | object | rank_search | rank_address |
96 Then place_addressline contains
97 | object | address | cached_rank_address |
101 Scenario: Admin levels cannot overtake each other due to place address ranks even when slightly misaligned
102 Given the named places
103 | osm | class | type | admin | extra+place | geometry |
104 | R20 | boundary | administrative | 6 | town | (0 0, 0 2, 2 2, 2 0, 0 0) |
105 | R21 | boundary | administrative | 8 | | (0 0, -0.0001 1, 1 1, 1 0, 0 0) |
108 | object | rank_search | rank_address |
111 Then place_addressline contains
112 | object | address | cached_rank_address |
115 Scenario: Admin levels must not be larger than 25
116 Given the named places
117 | osm | class | type | admin | extra+place | geometry |
118 | R20 | boundary | administrative | 6 | neighbourhood | (0 0, 0 2, 2 2, 2 0, 0 0) |
119 | R21 | boundary | administrative | 7 | | (0 0, 0 1, 1 1, 1 0, 0 0) |
120 | R22 | boundary | administrative | 8 | | (0 0, 0 0.5, 0.5 0.5, 0.5 0, 0 0) |
123 | object | rank_search | rank_address |
128 Scenario: admin levels contained in a place area must not overtake address ranks
129 Given the named places
130 | osm | class | type | admin | geometry |
131 | R10 | place | city | 15 | (0 0, 0 2, 2 0, 0 0) |
132 | R20 | boundary | administrative | 6 | (0 0, 0 1, 1 0, 0 0) |
135 | object | rank_search | rank_address |
139 Scenario: admin levels overlapping a place area are not demoted
140 Given the named places
141 | osm | class | type | admin | geometry |
142 | R10 | place | city | 15 | (0 0, 0 2, 2 0, 0 0) |
143 | R20 | boundary | administrative | 6 | (-1 0, 0 1, 1 0, -1 0) |
146 | object | rank_search | rank_address |
150 Scenario: admin levels with equal area as a place area are not demoted
151 Given the named places
152 | osm | class | type | admin | geometry |
153 | R10 | place | city | 15 | (0 0, 0 2, 2 0, 0 0) |
154 | R20 | boundary | administrative | 6 | (0 0, 0 2, 2 0, 0 0) |
157 | object | rank_search | rank_address |
162 Scenario: adjacent admin_levels are considered the same object when they have the same wikidata
163 Given the named places
164 | osm | class | type | admin | extra+wikidata | geometry |
165 | N20 | place | square | 15 | Q123 | 0.1 0.1 |
166 | R23 | boundary | administrative | 10 | Q444 | (0 0, 0 1, 1 1, 1 0, 0 0) |
167 | R21 | boundary | administrative | 9 | Q444 | (0 0, 0 1, 1 1, 1 0, 0 0) |
168 | R22 | boundary | administrative | 8 | Q444 | (0 0, 0 1, 1 1, 1 0, 0 0) |
171 | object | rank_search | rank_address |
175 Then place_addressline contains exactly
176 | object | address | cached_rank_address |
179 Scenario: adjacent admin_levels are considered different objects when they have different wikidata
180 Given the named places
181 | osm | class | type | admin | extra+wikidata | geometry |
182 | N20 | place | square | 15 | Q123 | 0.1 0.1 |
183 | R21 | boundary | administrative | 9 | Q4441 | (0 0, 0 1, 1 1, 1 0, 0 0) |
184 | R22 | boundary | administrative | 8 | Q444 | (0 0, 0 1, 1 1, 1 0, 0 0) |
187 | object | rank_search | rank_address |
190 Then place_addressline contains
191 | object | address | cached_rank_address |
195 Scenario: Mixes of admin boundaries and place areas I
202 | osm | class | type | admin | name | geometry |
203 | R1 | boundary | administrative | 5 | Greater London | (1,2,3,4,1) |
204 | R2 | boundary | administrative | 8 | Kensington | (1,10,11,4,1) |
206 | osm | class | type | name | geometry |
207 | R10 | place | city | London | (1,2,3,4,1) |
208 | N9 | place | town | Fulham | 9 |
209 | W1 | highway | residential | Lots Grove | 20,21 |
212 | object | rank_search | rank_address |
217 And place_addressline contains
218 | object | address | isaddress | cached_rank_address |
219 | W1 | R1 | True | 10 |
220 | W1 | R10 | True | 16 |
221 | W1 | R2 | True | 18 |
222 | W1 | N9 | False | 18 |
225 Scenario: Mixes of admin boundaries and place areas II
227 | 1 | | 10 | | 5 | 2 |
230 | 4 | | 11 | | 6 | 3 |
232 | osm | class | type | admin | name | geometry |
233 | R1 | boundary | administrative | 5 | Greater London | (1,2,3,4,1) |
234 | R2 | boundary | administrative | 8 | London | (1,5,6,4,1) |
236 | osm | class | type | name | geometry |
237 | R10 | place | city | Westminster | (1,10,11,4,1) |
238 | N9 | place | town | Fulham | 9 |
239 | W1 | highway | residential | Lots Grove | 20,21 |
242 | object | rank_search | rank_address |
247 And place_addressline contains
248 | object | address | isaddress | cached_rank_address |
249 | W1 | R1 | True | 10 |
250 | W1 | R10 | True | 18 |
251 | W1 | R2 | True | 16 |
252 | W1 | N9 | False | 18 |
255 Scenario: POI nodes with place tags
257 | osm | class | type | name | extratags |
258 | N23 | amenity | playground | AB | "place": "city" |
259 | N23 | place | city | AB | "amenity": "playground" |
261 Then placex contains exactly
262 | object | rank_search | rank_address |
263 | N23:amenity | 30 | 30 |
264 | N23:place | 16 | 16 |
266 Scenario: Address rank 25 is only used for addr:place
268 | 10 | 33 | 34 | 11 |
270 | osm | class | type | name |
271 | N10 | place | village | vil |
272 | N11 | place | farm | farm |
274 | osm | class | type | name | geometry |
275 | W1 | highway | residential | RD | 33,11 |
277 | osm | class | type | name | addr+farm | geometry |
278 | W2 | highway | residential | RD2 | farm | 34,11 |
280 | osm | class | type | housenr |
281 | N33 | place | house | 23 |
283 | osm | class | type | housenr | addr+place |
284 | N34 | place | house | 23 | farm |
287 | object | parent_place_id |
291 And place_addressline contains