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