]> git.openstreetmap.org Git - nominatim.git/blob - test/bdd/features/db/import/placex.feature
release 5.2.0.post7
[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: search and address ranks for boundaries are correctly assigned
50         Given the named places
51           | osm | class    | type |
52           | N1  | boundary | administrative |
53         And the named places
54           | osm | class    | type           | geometry |
55           | W10 | boundary | administrative | 10 10, 11 11 |
56         And the named places
57           | osm | class    | type           | admin | geometry |
58           | R20 | boundary | administrative | 2     | (1 1, 2 2, 1 2, 1 1) |
59           | R21 | boundary | administrative | 32    | (3 3, 4 4, 3 4, 3 3) |
60           | R22 | boundary | nature_park    | 6     | (0 0, 1 0, 0 1, 0 0) |
61           | R23 | boundary | natural_reserve| 10    | (0 0, 1 1, 1 0, 0 0) |
62         And the named places
63           | osm | class | type    | geometry |
64           | R40 | place | country | (1 1, 2 2, 1 2, 1 1) |
65           | R41 | place | state   | (3 3, 4 4, 3 4, 3 3) |
66         When importing
67         Then placex has no entry for N1
68         And placex has no entry for W10
69         And placex contains
70           | object | rank_search | rank_address |
71           | R20    | 4           | 4 |
72           | R21    | 25          | 0 |
73           | R22    | 25          | 0 |
74           | R23    | 25          | 0 |
75           | R40    | 4           | 0 |
76           | R41    | 8           | 0 |
77
78     Scenario: search and address ranks for highways correctly assigned
79         Given the grid
80           | 10 | 1 | 11 |   | 12 |   | 13 |  | 14 | | 15 |   | 16 |
81         And the places
82           | osm | class    | type  |
83           | N1  | highway  | bus_stop |
84         And the places
85           | osm | class    | type         | geometry |
86           | W1  | highway  | primary      | 10,11 |
87           | W2  | highway  | secondary    | 11,12 |
88           | W3  | highway  | tertiary     | 12,13 |
89           | W4  | highway  | residential  | 13,14 |
90           | W5  | highway  | unclassified | 14,15 |
91           | W6  | highway  | something    | 15,16 |
92         When importing
93         Then placex contains
94           | object | rank_search | rank_address |
95           | N1     | 30          | 30 |
96           | W1     | 26          | 26 |
97           | W2     | 26          | 26 |
98           | W3     | 26          | 26 |
99           | W4     | 26          | 26 |
100           | W5     | 26          | 26 |
101           | W6     | 30          | 30 |
102
103     Scenario: rank and inclusion of landuses
104         Given the 0.4 grid
105           | 1 | 2 | | | | | | 5 |
106           | 4 | 3 | | | | | | 6 |
107         Given the named places
108           | osm | class   | type |
109           | N2  | landuse | residential |
110         And the named places
111           | osm | class   | type        | geometry    |
112           | W2  | landuse | residential | 1,2,5       |
113           | W4  | landuse | residential | (1,4,3,1)   |
114           | R2  | landuse | residential | (1,2,3,4,1) |
115           | R3  | landuse | forrest     | (1,5,6,4,1) |
116         When importing
117         Then placex contains
118           | object | rank_search | rank_address |
119           | N2     | 30          | 30 |
120           | W2     | 30          | 30 |
121           | W4     | 24          | 24 |
122           | R2     | 24          | 24 |
123           | R3     | 24          |  0 |
124
125     Scenario: rank and inclusion of naturals
126         Given the 0.4 grid
127           | 1 | 2 | | | | | | 5 |
128           | 4 | 3 | | | | | | 6 |
129        Given the named places
130           | osm | class   | type |
131           | N2  | natural | peak |
132           | N4  | natural | volcano |
133           | N5  | natural | foobar |
134        And the named places
135           | osm | class   | type           | geometry    |
136           | W2  | natural | mountain_range | 1,2,5       |
137           | W3  | natural | foobar         | 2,3         |
138           | R3  | natural | volcano        | (1,2,4,1)   |
139           | R4  | natural | foobar         | (1,2,3,4,1) |
140           | R5  | natural | sea            | (1,2,5,6,3,4,1) |
141           | R6  | natural | sea            | (2,3,4,2)   |
142        When importing
143        Then placex contains
144           | object | rank_search | rank_address |
145           | N2     | 18          | 0 |
146           | N4     | 18          | 0 |
147           | N5     | 22          | 0 |
148           | W2     | 18          | 0 |
149           | R3     | 18          | 0 |
150           | R4     | 22          | 0 |
151           | R5     | 4           | 0 |
152           | R6     | 4           | 0 |
153           | W3     | 22          | 0 |
154
155     Scenario: boundary ways for countries and states are ignored
156         Given the 0.3 grid
157           | 1 | 2 |
158           | 4 | 3 |
159         Given the named places
160           | osm | class    | type           | admin | geometry |
161           | W4  | boundary | administrative | 2     | (1,2,3,4,1) |
162           | R4  | boundary | administrative | 2     | (1,2,3,4,1) |
163           | W5  | boundary | administrative | 3     | (1,2,3,4,1) |
164           | R5  | boundary | administrative | 3     | (1,2,3,4,1) |
165           | W6  | boundary | administrative | 4     | (1,2,3,4,1) |
166           | R6  | boundary | administrative | 4     | (1,2,3,4,1) |
167           | W7  | boundary | administrative | 5     | (1,2,3,4,1) |
168           | R7  | boundary | administrative | 5     | (1,2,3,4,1) |
169        When importing
170        Then placex contains exactly
171            | object |
172            | R4     |
173            | R5     |
174            | R6     |
175            | W7     |
176            | R7     |