2 Feature: Rank assignment
 
   3     Tests for assignment of search and address ranks.
 
   5     Scenario: Ranks for place nodes are assigned according to their type
 
   7           | osm  | class     | type      | geometry |
 
   8           | N1   | foo       | bar       | 0 0 |
 
   9           | N11  | place     | Continent | 0 0 |
 
  10           | N12  | place     | continent | 0 0 |
 
  11           | N13  | place     | sea       | 0 0 |
 
  12           | N14  | place     | country   | 0 0 |
 
  13           | N15  | place     | state     | 0 0 |
 
  14           | N16  | place     | region    | 0 0 |
 
  15           | N17  | place     | county    | 0 0 |
 
  16           | N18  | place     | city      | 0 0 |
 
  17           | N19  | place     | island    | 0 0 |
 
  18           | N36  | place     | house     | 0 0 |
 
  19           | N38  | place     | houses    | 0 0 |
 
  21           | osm  | class     | type      | extra+capital | geometry |
 
  22           | N101 | place     | city      | yes           | 0 0 |
 
  25           | object | rank_search | rank_address |
 
  40     Scenario: Ranks for boundaries are assigned according to admin level
 
  41         Given the named places
 
  42           | osm | class    | type           | admin | geometry |
 
  43           | R20 | boundary | administrative | 2     | (1 1, 2 2, 1 2, 1 1) |
 
  44           | R21 | boundary | administrative | 32    | (3 3, 4 4, 3 4, 3 3) |
 
  45           | R22 | boundary | administrative | 6     | (0 0, 1 0, 0 1, 0 0) |
 
  46           | R23 | boundary | administrative | 10    | (0 0, 1 1, 1 0, 0 0) |
 
  49           | object | rank_search | rank_address |
 
  55     Scenario: Ranks for addressable boundaries with place assignment go with place address ranks if available
 
  56         Given the named places
 
  57           | osm | class    | type           | admin | extra+place | geometry |
 
  58           | R20 | boundary | administrative | 3     | state       | (1 1, 2 2, 1 2, 1 1) |
 
  59           | R21 | boundary | administrative | 32    | suburb      | (3 3, 4 4, 3 4, 3 3) |
 
  60           | R22 | boundary | administrative | 6     | town        | (0 0, 1 0, 0 1, 0 0) |
 
  61           | R23 | boundary | administrative | 10    | village     | (0 0, 1 1, 1 0, 0 0) |
 
  64           | object | rank_search | rank_address |
 
  70     Scenario: Place address ranks cannot overtake a parent address rank
 
  71         Given the named places
 
  72           | osm | class    | type           | admin | extra+place  | geometry |
 
  73           | R20 | boundary | administrative | 8     | town         | (0 0, 0 2, 2 2, 2 0, 0 0) |
 
  74           | R21 | boundary | administrative | 9     | municipality | (0 0, 0 1, 1 1, 1 0, 0 0) |
 
  75           | R22 | boundary | administrative | 9     | suburb       | (0 0, 0 1, 1 1, 1 0, 0 0) |
 
  78           | object | rank_search | rank_address |
 
  82         Then place_addressline contains
 
  83             | object | address | cached_rank_address |
 
  87     Scenario: Admin levels cannot overtake each other due to place address ranks
 
  88         Given the named places
 
  89           | osm | class    | type           | admin | extra+place  | geometry |
 
  90           | R20 | boundary | administrative | 6     | town         | (0 0, 0 2, 2 2, 2 0, 0 0) |
 
  91           | R21 | boundary | administrative | 8     |              | (0 0, 0 1, 1 1, 1 0, 0 0) |
 
  92           | R22 | boundary | administrative | 8     | suburb       | (0 0, 0 1, 1 1, 1 0, 0 0) |
 
  95           | object | rank_search | rank_address |
 
  99         Then place_addressline contains
 
 100             | object | address | cached_rank_address |
 
 104     Scenario: Admin levels cannot overtake each other due to place address ranks even when slightly misaligned
 
 105         Given the named places
 
 106           | osm | class    | type           | admin | extra+place  | geometry |
 
 107           | R20 | boundary | administrative | 6     | town         | (0 0, 0 2, 2 2, 2 0, 0 0) |
 
 108           | R21 | boundary | administrative | 8     |              | (0 0, -0.0001 1, 1 1, 1 0, 0 0) |
 
 111           | object | rank_search | rank_address |
 
 114         Then place_addressline contains
 
 115             | object | address | cached_rank_address |
 
 118     Scenario: Admin levels must not be larger than 25
 
 119         Given the named places
 
 120           | osm | class    | type           | admin | extra+place   | geometry |
 
 121           | R20 | boundary | administrative | 6     | neighbourhood | (0 0, 0 2, 2 2, 2 0, 0 0) |
 
 122           | R21 | boundary | administrative | 7     |               | (0 0, 0 1, 1 1, 1 0, 0 0) |
 
 123           | R22 | boundary | administrative | 8     |               | (0 0, 0 0.5, 0.5 0.5, 0.5 0, 0 0) |
 
 126           | object | rank_search | rank_address |
 
 131     Scenario: admin levels contained in a place area must not overtake address ranks
 
 132         Given the named places
 
 133             | osm | class    | type           | admin | geometry |
 
 134             | R10 | place    | city           | 15    | (0 0, 0 2, 2 0, 0 0) |
 
 135             | R20 | boundary | administrative | 6     | (0 0, 0 1, 1 0, 0 0) |
 
 138             | object | rank_search | rank_address |
 
 142     Scenario: admin levels overlapping a place area are not demoted
 
 143         Given the named places
 
 144             | osm | class    | type           | admin | geometry |
 
 145             | R10 | place    | city           | 15    | (0 0, 0 2, 2 0, 0 0) |
 
 146             | R20 | boundary | administrative | 6     | (-1 0, 0 1, 1 0, -1 0) |
 
 149             | object | rank_search | rank_address |
 
 153     Scenario: admin levels with equal area as a place area are not demoted
 
 154         Given the named places
 
 155             | osm | class    | type           | admin | geometry |
 
 156             | R10 | place    | city           | 15    | (0 0, 0 2, 2 0, 0 0) |
 
 157             | R20 | boundary | administrative | 6     | (0 0, 0 2, 2 0, 0 0) |
 
 160             | object | rank_search | rank_address |
 
 165     Scenario: adjacent admin_levels are considered the same object when they have the same wikidata
 
 166         Given the named places
 
 167           | osm | class    | type           | admin | extra+wikidata | geometry |
 
 168           | N20 | place    | square         | 15    | Q123           | 0.1 0.1  |
 
 169           | R23 | boundary | administrative | 10    | Q444           | (0 0, 0 1, 1 1, 1 0, 0 0) |
 
 170           | R21 | boundary | administrative | 9     | Q444           | (0 0, 0 1, 1 1, 1 0, 0 0) |
 
 171           | R22 | boundary | administrative | 8     | Q444           | (0 0, 0 1, 1 1, 1 0, 0 0) |
 
 174           | object | rank_search | rank_address |
 
 178         Then place_addressline contains
 
 179             | object | address | cached_rank_address |
 
 181         Then place_addressline doesn't contain
 
 186     Scenario: adjacent admin_levels are considered different objects when they have different wikidata
 
 187         Given the named places
 
 188           | osm | class    | type           | admin | extra+wikidata | geometry |
 
 189           | N20 | place    | square         | 15    | Q123           | 0.1 0.1  |
 
 190           | R21 | boundary | administrative | 9     | Q4441          | (0 0, 0 1, 1 1, 1 0, 0 0) |
 
 191           | R22 | boundary | administrative | 8     | Q444           | (0 0, 0 1, 1 1, 1 0, 0 0) |
 
 194           | object | rank_search | rank_address |
 
 197         Then place_addressline contains
 
 198             | object | address | cached_rank_address |