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 |
 
  20           | osm  | class     | type      | extra+capital | geometry |
 
  21           | N101 | place     | city      | yes           | 0 0 |
 
  24           | object | rank_search | rank_address |
 
  38     Scenario: Ranks for boundaries are assigned according to admin level
 
  39         Given the named places
 
  40           | osm | class    | type           | admin | geometry |
 
  41           | R20 | boundary | administrative | 2     | (1 1, 2 2, 1 2, 1 1) |
 
  42           | R21 | boundary | administrative | 32    | (3 3, 4 4, 3 4, 3 3) |
 
  43           | R22 | boundary | administrative | 6     | (0 0, 1 0, 0 1, 0 0) |
 
  44           | R23 | boundary | administrative | 10    | (0 0, 1 1, 1 0, 0 0) |
 
  47           | object | rank_search | rank_address |
 
  53     Scenario: Ranks for addressable boundaries with place assignment go with place address ranks if available
 
  54         Given the named places
 
  55           | osm | class    | type           | admin | extra+place | geometry |
 
  56           | R20 | boundary | administrative | 3     | state       | (1 1, 2 2, 1 2, 1 1) |
 
  57           | R21 | boundary | administrative | 32    | suburb      | (3 3, 4 4, 3 4, 3 3) |
 
  58           | R22 | boundary | administrative | 6     | town        | (0 0, 1 0, 0 1, 0 0) |
 
  59           | R23 | boundary | administrative | 10    | village     | (0 0, 1 1, 1 0, 0 0) |
 
  62           | object | rank_search | rank_address |
 
  68     Scenario: Place address ranks cannot overtake a parent address rank
 
  69         Given the named places
 
  70           | osm | class    | type           | admin | extra+place  | geometry |
 
  71           | R20 | boundary | administrative | 8     | town         | (0 0, 0 2, 2 2, 2 0, 0 0) |
 
  72           | R21 | boundary | administrative | 9     | municipality | (0 0, 0 1, 1 1, 1 0, 0 0) |
 
  73           | R22 | boundary | administrative | 9     | suburb       | (0 0, 0 1, 1 1, 1 0, 0 0) |
 
  76           | object | rank_search | rank_address |
 
  80         Then place_addressline contains
 
  81             | object | address | cached_rank_address |
 
  85     Scenario: Admin levels cannot overtake each other due to place address ranks
 
  86         Given the named places
 
  87           | osm | class    | type           | admin | extra+place  | geometry |
 
  88           | R20 | boundary | administrative | 6     | town         | (0 0, 0 2, 2 2, 2 0, 0 0) |
 
  89           | R21 | boundary | administrative | 8     |              | (0 0, 0 1, 1 1, 1 0, 0 0) |
 
  90           | R22 | boundary | administrative | 8     | suburb       | (0 0, 0 1, 1 1, 1 0, 0 0) |
 
  93           | object | rank_search | rank_address |
 
  97         Then place_addressline contains
 
  98             | object | address | cached_rank_address |
 
 102     Scenario: Admin levels cannot overtake each other due to place address ranks even when slightly misaligned
 
 103         Given the named places
 
 104           | osm | class    | type           | admin | extra+place  | geometry |
 
 105           | R20 | boundary | administrative | 6     | town         | (0 0, 0 2, 2 2, 2 0, 0 0) |
 
 106           | R21 | boundary | administrative | 8     |              | (0 0, -0.0001 1, 1 1, 1 0, 0 0) |
 
 109           | object | rank_search | rank_address |
 
 112         Then place_addressline contains
 
 113             | object | address | cached_rank_address |
 
 116     Scenario: Admin levels must not be larger than 25
 
 117         Given the named places
 
 118           | osm | class    | type           | admin | extra+place   | geometry |
 
 119           | R20 | boundary | administrative | 6     | neighbourhood | (0 0, 0 2, 2 2, 2 0, 0 0) |
 
 120           | R21 | boundary | administrative | 7     |               | (0 0, 0 1, 1 1, 1 0, 0 0) |
 
 121           | R22 | boundary | administrative | 8     |               | (0 0, 0 0.5, 0.5 0.5, 0.5 0, 0 0) |
 
 124           | object | rank_search | rank_address |
 
 129     Scenario: admin levels contained in a place area must not overtake address ranks
 
 130         Given the named places
 
 131             | osm | class    | type           | admin | geometry |
 
 132             | R10 | place    | city           | 15    | (0 0, 0 2, 2 0, 0 0) |
 
 133             | R20 | boundary | administrative | 6     | (0 0, 0 1, 1 0, 0 0) |
 
 136             | object | rank_search | rank_address |
 
 140     Scenario: admin levels overlapping a place area are not demoted
 
 141         Given the named places
 
 142             | osm | class    | type           | admin | geometry |
 
 143             | R10 | place    | city           | 15    | (0 0, 0 2, 2 0, 0 0) |
 
 144             | R20 | boundary | administrative | 6     | (-1 0, 0 1, 1 0, -1 0) |
 
 147             | object | rank_search | rank_address |
 
 151     Scenario: admin levels with equal area as a place area are not demoted
 
 152         Given the named places
 
 153             | osm | class    | type           | admin | geometry |
 
 154             | R10 | place    | city           | 15    | (0 0, 0 2, 2 0, 0 0) |
 
 155             | R20 | boundary | administrative | 6     | (0 0, 0 2, 2 0, 0 0) |
 
 158             | object | rank_search | rank_address |
 
 163     Scenario: adjacent admin_levels are considered the same object when they have the same wikidata
 
 164         Given the named places
 
 165           | osm | class    | type           | admin | extra+wikidata | geometry |
 
 166           | N20 | place    | square         | 15    | Q123           | 0.1 0.1  |
 
 167           | R23 | boundary | administrative | 10    | Q444           | (0 0, 0 1, 1 1, 1 0, 0 0) |
 
 168           | R21 | boundary | administrative | 9     | Q444           | (0 0, 0 1, 1 1, 1 0, 0 0) |
 
 169           | R22 | boundary | administrative | 8     | Q444           | (0 0, 0 1, 1 1, 1 0, 0 0) |
 
 172           | object | rank_search | rank_address |
 
 176         Then place_addressline contains
 
 177             | object | address | cached_rank_address |
 
 179         Then place_addressline doesn't contain
 
 184     Scenario: adjacent admin_levels are considered different objects when they have different wikidata
 
 185         Given the named places
 
 186           | osm | class    | type           | admin | extra+wikidata | geometry |
 
 187           | N20 | place    | square         | 15    | Q123           | 0.1 0.1  |
 
 188           | R21 | boundary | administrative | 9     | Q4441          | (0 0, 0 1, 1 1, 1 0, 0 0) |
 
 189           | R22 | boundary | administrative | 8     | Q444           | (0 0, 0 1, 1 1, 1 0, 0 0) |
 
 192           | object | rank_search | rank_address |
 
 195         Then place_addressline contains
 
 196             | object | address | cached_rank_address |