1 Feature: Linking of places
 
   2     Tests for correctly determining linked places
 
   4     Scenario: Only address-describing places can be linked
 
  10          | osm  | class   | type   | name  | geometry |
 
  11          | R13  | landuse | forest | Garbo | (1,2,3,4,1) |
 
  12          | N256 | natural | peak   | Garbo | 9 |
 
  15          | object  | linked_place_id |
 
  19     Scenario: Postcode areas cannot be linked
 
  20         Given the grid with origin US
 
  25          | osm | class    | type        | addr+postcode  | extra+wikidata | geometry    |
 
  26          | R13 | boundary | postal_code | 12345          | Q87493         | (1,2,3,4,1) |
 
  27          | N25 | place    | suburb      | 12345          | Q87493         | 9 |
 
  30          | object | linked_place_id |
 
  34      Scenario: Waterways are linked when in waterway relations
 
  36          | 1 |  |   |  | 3 | 4  |  |   |  | 6 |
 
  37          |   |  | 2 |  |   | 10 |  | 5 |  |   |
 
  38          |   |  |   |  |   | 11 |  |   |  |   |
 
  40          | osm | class    | type  | name  | geometry |
 
  41          | W1  | waterway | river | Rhein | 1,2,3    |
 
  42          | W2  | waterway | river | Rhein | 3,4,5    |
 
  43          | R13 | waterway | river | Rhein | 1,2,3,4,5,6 |
 
  44          | R23 | waterway | river | Limmat| 4,10,11  |
 
  46          | id | members                          | tags+type |
 
  47          | 13 | R23:tributary,W1,W2:main_stream  | waterway |
 
  50          | object | linked_place_id |
 
  55         When geocoding "rhein"
 
  56         Then the result set contains
 
  60     Scenario: Relations are not linked when in waterway relations
 
  62          | 1 |  |   |  | 3 | 4  |  |   |  | 6 |
 
  63          |   |  | 2 |  |   | 10 |  | 5 |  |   |
 
  64          |   |  |   |  |   | 11 |  |   |  |   |
 
  66          | osm | class    | type   | name  | geometry |
 
  67          | W1  | waterway | stream | Rhein | 1,2,3,4 |
 
  68          | W2  | waterway | river  | Rhein | 4,5,6 |
 
  69          | R1  | waterway | river  | Rhein | 1,2,3,4 |
 
  70          | R2  | waterway | river  | Limmat| 4,10,11 |
 
  72          | id | members                          | tags+type |
 
  76          | object | linked_place_id |
 
  81         When geocoding "rhein"
 
  82         Then result 0 contains
 
  90     Scenario: Empty waterway relations are handled correctly
 
  94          | osm | class    | type  | name  | geometry |
 
  95          | R1  | waterway | river | Rhein | 1,3 |
 
  97          | id | members  | tags+type |
 
 101          | object | linked_place_id |
 
 104     Scenario: Waterways are not linked when the way type is not a river feature
 
 110          | osm | class    | type     | name  | geometry |
 
 111          | W1  | waterway | lock     | Rhein | 3,4 |
 
 112          | R1  | landuse  | meadow   | Rhein | (3,1,2,4,3) |
 
 114          | id | members      | tags+type |
 
 115          | 1  | W1,W2        | multipolygon |
 
 118          | object | linked_place_id |
 
 122     Scenario: Side streams are linked only when they have the same name
 
 125          | 1 |  | 2 | 3 |   | 4 | 5 | 6|
 
 128          | osm | class    | type  | name   | geometry |
 
 129          | W1  | waterway | river | Rhein2 | 2,8,4 |
 
 130          | W2  | waterway | river | Rhein  | 3,9,5 |
 
 131          | R1  | waterway | river | Rhein  | 1,2,3,4,5,6 |
 
 133          | id | members                           | tags+type |
 
 134          | 1  | W1:side_stream,W2:side_stream,W3  | waterway |
 
 137          | object | linked_place_id |
 
 140         When geocoding "rhein2"
 
 141         Then the result set contains
 
 146     Scenario: Boundaries should only be linked to places
 
 151         Given the named places
 
 152          | osm | class    | type           | extra+wikidata | admin | geometry    |
 
 153          | R1  | boundary | administrative | 34             | 8     | (1,2,3,4,1) |
 
 155          | osm | class    | type           |
 
 156          | N9  | natural  | island         |
 
 157          | N9  | place    | city           |
 
 163          | object     | linked_place_id |
 
 167     Scenario: Nodes with 'role' label are always linked
 
 173          | osm  | class    | type           | admin | name  | geometry    |
 
 174          | R13  | boundary | administrative | 6     | Garbo | (1,2,3,4,1) |
 
 175          | N2   | place    | hamlet         | 15    | Vario | 9           |
 
 177          | id | members       | tags+type |
 
 178          | 13 | N2:label      | boundary |
 
 181          | object  | linked_place_id |
 
 184          | object | centroid!wkt | name+name | extratags+linked_place |
 
 185          | R13    | 9            | Garbo     | hamlet |
 
 187     Scenario: Boundaries with place tags are linked against places with same type
 
 193          | osm  | class    | type           | admin | name   | extra+place | geometry    |
 
 194          | R13  | boundary | administrative | 4     | Berlin | city        | (1,2,3,4,1) |
 
 196          | osm  | class    | type           | name   | geometry |
 
 197          | N2   | place    | city           | Berlin | 9 |
 
 200          | object  | linked_place_id |
 
 203          | object | rank_address |
 
 208         Then result 0 contains
 
 214         Then result 0 contains
 
 219     Scenario: Boundaries without place tags only link against same admin level
 
 225          | osm  | class    | type           | admin | name   | geometry |
 
 226          | R13  | boundary | administrative | 4     | Berlin | (1,2,3,4,1) |
 
 228          | osm  | class    | type           | name   | geometry |
 
 229          | N2   | place    | city           | Berlin | 9 |
 
 232          | object  | linked_place_id |
 
 235          | object | rank_address |
 
 240         Then result 0 contains
 
 246         Then result 0 contains
 
 251     Scenario: Do not use linked centroid when it is outside the area
 
 256         Given the named places
 
 257          | osm  | class    | type           | admin | geometry |
 
 258          | R13  | boundary | administrative | 4     | (1,2,3,4,1) |
 
 260          | osm  | class    | type           | geometry |
 
 261          | N2   | place    | city           | 9 |
 
 263          | id | members       | tags+type |
 
 264          | 13 | N2:label      | boundary |
 
 267          | object | linked_place_id |
 
 270          | object | centroid!in_box |
 
 271          | R13    | 0,0,0.1,0.1      |
 
 273     Scenario: Place nodes can only be linked once
 
 278         Given the named places
 
 279          | osm  | class    | type | extra+wikidata | geometry |
 
 280          | N2   | place    | city | Q1234          | 9        |
 
 282          | osm  | class    | type           | extra+wikidata | admin | geometry        |
 
 283          | R1   | boundary | administrative | Q1234          | 8     | (1,2,5,6,3,4,1) |
 
 284          | R2   | boundary | administrative | Q1234          | 9     | (1,2,3,4,1)     |
 
 287          | object | linked_place_id |
 
 290          | object | extratags!dict                |
 
 291          | R1     | 'linked_place' : 'city', 'wikidata': 'Q1234'  |
 
 292          | R2     | 'wikidata': 'Q1234'                     |
 
 295     Scenario: Boundaries without names inherit names from linked places
 
 301          | osm | class    | type           | extra+wikidata | admin | geometry    |
 
 302          | R1  | boundary | administrative | 34             | 8     | (1,2,3,4,1) |
 
 304          | osm | class    | type           | name+name  |
 
 305          | N9  | place    | city           | LabelPlace |
 
 311          | object     | name+_place_name  |
 
 316     Scenario: Linked places expand default language names
 
 322             | osm | class    | type           | name+name                | geometry    |
 
 323             | N9  | place    | city           | Popayán                  | 9           |
 
 324             | R1  | boundary | administrative | Perímetro Urbano Popayán | (1,2,3,4,1) |
 
 330             | object | name+_place_name | name+_place_name:es |
 
 331             | R1     | Popayán          | Popayán             |