]> git.openstreetmap.org Git - nominatim.git/blob - tests/features/db/import/linking.feature
add functional tests
[nominatim.git] / tests / features / db / import / linking.feature
1 @DB
2 Feature: Linking of places
3     Tests for correctly determining linked places
4
5     Scenario: Waterways are linked when in waterway relations
6         Given the scene split-road
7         And the place ways
8          | osm_type | osm_id | class    | type  | name  | geometry
9          | W        | 1      | waterway | river | Rhein | :w-2
10          | W        | 2      | waterway | river | Rhein | :w-3
11          | R        | 13     | waterway | river | Rhein | :w-1 + :w-2 + :w-3
12          | R        | 23     | waterway | river | Limmat| :w-4a
13         And the relations
14          | id | members                          | tags
15          | 13 | R23:tributary,W1,W2:main_stream  | 'type' : 'waterway'
16         When importing
17         Then table placex contains
18          | object | linked_place_id
19          | W1     | R13
20          | W2     | R13
21          | R13    | None
22          | R23    | None
23         When sending query "rhein"
24         Then results contain
25          | osm_type
26          | R
27
28     Scenario: Relations are not linked when in waterway relations
29         Given the scene split-road
30         And the place ways
31          | osm_type | osm_id | class    | type  | name  | geometry
32          | W        | 1      | waterway | river | Rhein | :w-2
33          | W        | 2      | waterway | river | Rhein | :w-3
34          | R        | 1      | waterway | river | Rhein | :w-1 + :w-2 + :w-3
35          | R        | 2      | waterway | river | Limmat| :w-4a
36         And the relations
37          | id | members                          | tags
38          | 1  | R2                               | 'type' : 'waterway'
39         When importing
40         Then table placex contains
41          | object | linked_place_id
42          | W1     | None
43          | W2     | None
44          | R1     | None
45          | R2     | None
46
47     Scenario: Empty waterway relations are handled correctly
48         Given the scene split-road
49         And the place ways
50          | osm_type | osm_id | class    | type  | name  | geometry
51          | R        | 1      | waterway | river | Rhein | :w-1 + :w-2 + :w-3
52         And the relations
53          | id | members                          | tags
54          | 1 |                                  | 'type' : 'waterway'
55         When importing
56         Then table placex contains
57          | object | linked_place_id
58          | R1     | None
59
60     Scenario: Waterways are not linked when waterway types don't match
61         Given the scene split-road
62         And the place ways
63          | osm_type | osm_id | class    | type     | name  | geometry
64          | W        | 1      | waterway | drain    | Rhein | :w-2
65          | R        | 1      | waterway | river    | Rhein | :w-1 + :w-2 + :w-3
66         And the relations
67          | id | members               | tags
68          | 1  | N23,N34,W1,R45        | 'type' : 'multipolygon'
69         When importing
70         Then table placex contains
71          | object | linked_place_id
72          | W1     | None
73          | R1     | None
74         When sending query "rhein"
75         Then results contain
76           | ID | osm_type
77           |  0 | R
78           |  1 | W
79
80     Scenario: Side streams are linked only when they have the same name
81         Given the scene split-road
82         And the place ways
83          | osm_type | osm_id | class    | type  | name   | geometry
84          | W        | 1      | waterway | river | Rhein2 | :w-2
85          | W        | 2      | waterway | river | Rhein  | :w-3
86          | R        | 1      | waterway | river | Rhein  | :w-1 + :w-2 + :w-3
87         And the relations
88          | id | members                           | tags
89          | 1  | W1:side_stream,W2:side_stream     | 'type' : 'waterway'
90         When importing
91         Then table placex contains
92          | object | linked_place_id
93          | W1     | None
94          | W2     | R1
95         When sending query "rhein2"
96         Then results contain
97          | osm_type
98          | W