]> git.openstreetmap.org Git - nominatim.git/blob - test/bdd/db/import/placex.feature
Merge pull request #2985 from lonvia/fix-place-rank-inheritance
[nominatim.git] / test / bdd / db / import / placex.feature
1 @DB
2 Feature: Import into placex
3     Tests that data in placex is completed correctly.
4
5     Scenario: No country code tag is available
6         Given the named places
7           | osm | class   | type     | geometry   |
8           | N1  | highway | primary  | country:us |
9         When importing
10         Then placex contains
11           | object | addr+country | country_code |
12           | N1     | -            | us           |
13
14     Scenario: Location overwrites country code tag
15         Given the named places
16           | osm | class   | type     | country | geometry |
17           | N1  | highway | primary  | de      | country:us |
18         When importing
19         Then placex contains
20           | object | addr+country | country_code |
21           | N1     | de           | us           |
22
23     Scenario: Country code tag overwrites location for countries
24         Given the named places
25           | osm | class    | type            | admin | country | geometry |
26           | R1  | boundary | administrative  | 2     | de      | (-100 40, -101 40, -101 41, -100 41, -100 40) |
27         When importing
28         Then placex contains
29           | object | rank_search| addr+country | country_code |
30           | R1     | 4          | de           | de           |
31
32     Scenario: Illegal country code tag for countries is ignored
33         Given the named places
34           | osm | class    | type            | admin | country | geometry |
35           | R1  | boundary | administrative  | 2     | xx      | (-100 40, -101 40, -101 41, -100 41, -100 40) |
36         When importing
37         Then placex contains
38           | object | addr+country | country_code |
39           | R1     | xx           | us           |
40
41     Scenario: admin level is copied over
42         Given the named places
43           | osm | class | type      | admin |
44           | N1  | place | state     | 3     |
45         When importing
46         Then placex contains
47           | object | admin_level |
48           | N1     | 3           |
49
50     Scenario: postcode node without postcode is dropped
51         Given the places
52           | osm | class   | type     | name+ref |
53           | N1  | place   | postcode | 12334    |
54         When importing
55         Then placex has no entry for N1
56
57     Scenario: postcode boundary without postcode is dropped
58         Given the 0.01 grid
59           | 1 | 2 |
60           | 3 |   |
61         Given the places
62           | osm | class    | type        | name+ref | geometry  |
63           | R1  | boundary | postal_code | 554476   | (1,2,3,1) |
64         When importing
65         Then placex has no entry for R1
66
67     Scenario: search and address ranks for boundaries are correctly assigned
68         Given the named places
69           | osm | class    | type |
70           | N1  | boundary | administrative |
71         And the named places
72           | osm | class    | type           | geometry |
73           | W10 | boundary | administrative | 10 10, 11 11 |
74         And the named places
75           | osm | class    | type           | admin | geometry |
76           | R20 | boundary | administrative | 2     | (1 1, 2 2, 1 2, 1 1) |
77           | R21 | boundary | administrative | 32    | (3 3, 4 4, 3 4, 3 3) |
78           | R22 | boundary | nature_park    | 6     | (0 0, 1 0, 0 1, 0 0) |
79           | R23 | boundary | natural_reserve| 10    | (0 0, 1 1, 1 0, 0 0) |
80         And the named places
81           | osm | class | type    | geometry |
82           | R40 | place | country | (1 1, 2 2, 1 2, 1 1) |
83           | R41 | place | state   | (3 3, 4 4, 3 4, 3 3) |
84         When importing
85         Then placex has no entry for N1
86         And placex has no entry for W10
87         And placex contains
88           | object | rank_search | rank_address |
89           | R20    | 4           | 4 |
90           | R21    | 25          | 0 |
91           | R22    | 25          | 0 |
92           | R23    | 25          | 0 |
93           | R40    | 4           | 0 |
94           | R41    | 8           | 0 |
95
96     Scenario: search and address ranks for highways correctly assigned
97         Given the grid
98           | 10 | 1 | 11 |   | 12 |   | 13 |  | 14 | | 15 |   | 16 |
99         And the places
100           | osm | class    | type  |
101           | N1  | highway  | bus_stop |
102         And the places
103           | osm | class    | type         | geometry |
104           | W1  | highway  | primary      | 10,11 |
105           | W2  | highway  | secondary    | 11,12 |
106           | W3  | highway  | tertiary     | 12,13 |
107           | W4  | highway  | residential  | 13,14 |
108           | W5  | highway  | unclassified | 14,15 |
109           | W6  | highway  | something    | 15,16 |
110         When importing
111         Then placex contains
112           | object | rank_search | rank_address |
113           | N1     | 30          | 30 |
114           | W1     | 26          | 26 |
115           | W2     | 26          | 26 |
116           | W3     | 26          | 26 |
117           | W4     | 26          | 26 |
118           | W5     | 26          | 26 |
119           | W6     | 30          | 30 |
120
121     Scenario: rank and inclusion of landuses
122         Given the 0.4 grid
123           | 1 | 2 | | | | | | 5 |
124           | 4 | 3 | | | | | | 6 |
125         Given the named places
126           | osm | class   | type |
127           | N2  | landuse | residential |
128         And the named places
129           | osm | class   | type        | geometry    |
130           | W2  | landuse | residential | 1,2,5       |
131           | W4  | landuse | residential | (1,4,3,1)   |
132           | R2  | landuse | residential | (1,2,3,4,1) |
133           | R3  | landuse | forrest     | (1,5,6,4,1) |
134         When importing
135         Then placex contains
136           | object | rank_search | rank_address |
137           | N2     | 30          | 30 |
138           | W2     | 30          | 30 |
139           | W4     | 22          | 22 |
140           | R2     | 22          | 22 |
141           | R3     | 22          |  0 |
142
143     Scenario: rank and inclusion of naturals
144         Given the 0.4 grid
145           | 1 | 2 | | | | | | 5 |
146           | 4 | 3 | | | | | | 6 |
147        Given the named places
148           | osm | class   | type |
149           | N2  | natural | peak |
150           | N4  | natural | volcano |
151           | N5  | natural | foobar |
152        And the named places
153           | osm | class   | type           | geometry    |
154           | W2  | natural | mountain_range | 1,2,5       |
155           | W3  | natural | foobar         | 2,3         |
156           | R3  | natural | volcano        | (1,2,4,1)   |
157           | R4  | natural | foobar         | (1,2,3,4,1) |
158           | R5  | natural | sea            | (1,2,5,6,3,4,1) |
159           | R6  | natural | sea            | (2,3,4,2)   |
160        When importing
161        Then placex contains
162           | object | rank_search | rank_address |
163           | N2     | 18          | 0 |
164           | N4     | 18          | 0 |
165           | N5     | 22          | 0 |
166           | W2     | 18          | 0 |
167           | R3     | 18          | 0 |
168           | R4     | 22          | 0 |
169           | R5     | 4           | 0 |
170           | R6     | 4           | 0 |
171           | W3     | 22          | 0 |
172
173     Scenario: boundary ways for countries and states are ignored
174         Given the 0.3 grid
175           | 1 | 2 |
176           | 4 | 3 |
177         Given the named places
178           | osm | class    | type           | admin | geometry |
179           | W4  | boundary | administrative | 2     | (1,2,3,4,1) |
180           | R4  | boundary | administrative | 2     | (1,2,3,4,1) |
181           | W5  | boundary | administrative | 3     | (1,2,3,4,1) |
182           | R5  | boundary | administrative | 3     | (1,2,3,4,1) |
183           | W6  | boundary | administrative | 4     | (1,2,3,4,1) |
184           | R6  | boundary | administrative | 4     | (1,2,3,4,1) |
185           | W7  | boundary | administrative | 5     | (1,2,3,4,1) |
186           | R7  | boundary | administrative | 5     | (1,2,3,4,1) |
187        When importing
188        Then placex contains exactly
189            | object |
190            | R4     |
191            | R5     |
192            | R6     |
193            | W7     |
194            | R7     |