]> git.openstreetmap.org Git - nominatim.git/blob - tests/features/db/import/interpolation.feature
cleanup of SQL for readability. No logic change
[nominatim.git] / tests / features / db / import / interpolation.feature
1 @DB
2 Feature: Import of address interpolations
3     Tests that interpolated addresses are added correctly
4
5     Scenario: Simple even interpolation line with two points
6         Given the place nodes
7           | osm_id | osm_type | class | type  | housenumber | geometry
8           | 1      | N        | place | house | 2           | 1 1
9           | 2      | N        | place | house | 6           | 1 1.001
10         And the place ways
11           | osm_id | osm_type | class | type   | housenumber | geometry
12           | 1      | W        | place | houses | even        | 1 1, 1 1.001
13         And the ways
14           | id | nodes
15           | 1  | 1,2
16         When importing
17         Then way 1 expands to lines
18           | startnumber | endnumber | geometry
19           | 2           | 6         | 1 1, 1 1.001
20
21     Scenario: Backwards even two point interpolation line
22         Given the place nodes
23           | osm_id | class | type  | housenumber | geometry
24           | 1      | place | house | 2           | 1 1
25           | 2      | place | house | 6           | 1 1.001
26         And the place ways
27           | osm_id | class | type   | housenumber | geometry
28           | 1      | place | houses | even        | 1 1.001, 1 1
29         And the ways
30           | id | nodes
31           | 1  | 2,1
32         When importing
33         Then way 1 expands to lines
34           | startnumber | endnumber | geometry
35           | 2           | 6         | 1 1, 1 1.001
36
37       Scenario: Simple odd two point interpolation
38         Given the place nodes
39           | osm_id | class | type  | housenumber | geometry
40           | 1      | place | house | 1           | 1 1
41           | 2      | place | house | 11          | 1 1.001
42         And the place ways
43           | osm_id | class | type   | housenumber | geometry
44           | 1      | place | houses | odd         | 1 1, 1 1.001
45         And the ways
46           | id | nodes
47           | 1  | 1,2
48         When importing
49         Then way 1 expands to lines
50           | startnumber | endnumber | geometry
51           | 1           | 11        | 1 1, 1 1.001
52
53      Scenario: Simple all two point interpolation
54         Given the place nodes
55           | osm_id | class | type  | housenumber | geometry
56           | 1      | place | house | 1           | 1 1
57           | 2      | place | house | 3           | 1 1.001
58         And the place ways
59           | osm_id | class | type   | housenumber | geometry
60           | 1      | place | houses | all         | 1 1, 1 1.001
61         And the ways
62           | id | nodes
63           | 1  | 1,2
64         When importing
65         Then way 1 expands to lines
66           | startnumber | endnumber | geometry
67           | 1           | 3         | 1 1, 1 1.001
68
69     Scenario: Even two point interpolation line with intermediate empty node
70         Given the place nodes
71           | osm_id | class | type  | housenumber | geometry
72           | 1      | place | house | 2           | 1 1
73           | 2      | place | house | 10          | 1.001 1.001
74         And the place ways
75           | osm_id | class | type   | housenumber | geometry
76           | 1      | place | houses | even        | 1 1, 1 1.001, 1.001 1.001
77         And the ways
78           | id | nodes
79           | 1  | 1,3,2
80         When importing
81         Then way 1 expands to lines
82           | startnumber | endnumber | geometry
83           | 2           | 10         | 1 1, 1 1.001, 1.001 1.001
84
85     Scenario: Even two point interpolation line with intermediate duplicated empty node
86         Given the place nodes
87           | osm_id | class | type  | housenumber | geometry
88           | 1      | place | house | 2           | 1 1
89           | 2      | place | house | 10          | 1.001 1.001
90         And the place ways
91           | osm_id | class | type   | housenumber | geometry
92           | 1      | place | houses | even        | 1 1, 1 1.001, 1.001 1.001
93         And the ways
94           | id | nodes
95           | 1  | 1,3,3,2
96         When importing
97         Then way 1 expands to lines
98           | startnumber | endnumber | geometry
99           | 2           | 10         | 1 1, 1 1.001, 1.001 1.001
100
101     Scenario: Simple even three point interpolation line
102         Given the place nodes
103           | osm_id | class | type  | housenumber | geometry
104           | 1      | place | house | 2           | 1 1
105           | 2      | place | house | 14          | 1.001 1.001
106           | 3      | place | house | 10          | 1 1.001
107         And the place ways
108           | osm_id | class | type   | housenumber | geometry
109           | 1      | place | houses | even        | 1 1, 1 1.001, 1.001 1.001
110         And the ways
111           | id | nodes
112           | 1  | 1,3,2
113         When importing
114         Then way 1 expands to lines
115           | startnumber | endnumber | geometry
116           | 2           | 10        | 1 1, 1 1.001
117           | 10          | 14        | 1 1.001, 1.001 1.001
118
119      Scenario: Simple even four point interpolation line
120         Given the place nodes
121           | osm_id | class | type  | housenumber | geometry
122           | 1      | place | house | 2           | 1 1
123           | 2      | place | house | 14          | 1.001 1.001
124           | 3      | place | house | 10          | 1 1.001
125           | 4      | place | house | 18          | 1.001 1.002
126         And the place ways
127           | osm_id | class | type   | housenumber | geometry
128           | 1      | place | houses | even        | 1 1, 1 1.001, 1.001 1.001, 1.001 1.002
129         And the ways
130           | id | nodes
131           | 1  | 1,3,2,4
132         When importing
133         Then way 1 expands to lines
134           | startnumber | endnumber | geometry
135           | 2           | 10        | 1 1, 1 1.001
136           | 10          | 14        | 1 1.001, 1.001 1.001
137           | 14          | 18        | 1.001 1.001, 1.001 1.002
138
139     Scenario: Reverse simple even three point interpolation line
140         Given the place nodes
141           | osm_id | class | type  | housenumber | geometry
142           | 1      | place | house | 2           | 1 1
143           | 2      | place | house | 14          | 1.001 1.001
144           | 3      | place | house | 10          | 1 1.001
145         And the place ways
146           | osm_id | class | type   | housenumber | geometry
147           | 1      | place | houses | even        | 1.001 1.001, 1 1.001, 1 1
148         And the ways
149           | id | nodes
150           | 1  | 2,3,1
151         When importing
152         Then way 1 expands to lines
153           | startnumber | endnumber | geometry
154           | 2           | 10        | 1 1, 1 1.001
155           | 10          | 14        | 1 1.001, 1.001 1.001
156
157     Scenario: Even three point interpolation line with odd center point
158         Given the place nodes
159           | osm_id | class | type  | housenumber | geometry
160           | 1      | place | house | 2           | 1 1
161           | 2      | place | house | 8           | 1.001 1.001
162           | 3      | place | house | 7           | 1 1.001
163         And the place ways
164           | osm_id | class | type   | housenumber | geometry
165           | 1      | place | houses | even        | 1 1, 1 1.001, 1.001 1.001
166         And the ways
167           | id | nodes
168           | 1  | 1,3,2
169         When importing
170         Then way 1 expands to lines
171           | startnumber | endnumber | geometry
172           | 2           | 7         | 1 1, 1 1.001
173           | 7           | 8         | 1 1.001, 1.001 1.001
174
175     Scenario: Interpolation line with self-intersecting way
176         Given the place nodes
177           | osm_id | class | type  | housenumber | geometry
178           | 1      | place | house | 2           | 0 0
179           | 2      | place | house | 6           | 0 0.001
180           | 3      | place | house | 10          | 0 0.002
181         And the place ways
182           | osm_id | class | type   | housenumber | geometry
183           | 1      | place | houses | even        | 0 0, 0 0.001, 0 0.002, 0 0.001
184         And the ways
185           | id | nodes
186           | 1  | 1,2,3,2
187         When importing
188         Then way 1 expands to lines
189           | startnumber | endnumber | geometry
190           | 2           | 6         | 0 0, 0 0.001
191           | 6           | 10        | 0 0.001, 0 0.002
192           | 6           | 10        | 0 0.001, 0 0.002
193
194     Scenario: Interpolation line with self-intersecting way II
195         Given the place nodes
196           | osm_id | class | type  | housenumber | geometry
197           | 1      | place | house | 2           | 0 0
198           | 2      | place | house | 6           | 0 0.001
199         And the place ways
200           | osm_id | class | type   | housenumber | geometry
201           | 1      | place | houses | even        | 0 0, 0 0.001, 0 0.002, 0 0.001
202         And the ways
203           | id | nodes
204           | 1  | 1,2,3,2
205         When importing
206         Then way 1 expands to lines
207           | startnumber | endnumber | geometry
208           | 2           | 6         | 0 0, 0 0.001
209
210     Scenario: addr:street on interpolation way
211         Given the scene parallel-road
212         And the place nodes
213           | osm_id | class | type  | housenumber | geometry
214           | 1      | place | house | 2           | :n-middle-w
215           | 2      | place | house | 6           | :n-middle-e
216           | 3      | place | house | 12          | :n-middle-w
217           | 4      | place | house | 16          | :n-middle-e
218         And the place ways
219           | osm_id | class   | type    | housenumber | street       | geometry
220           | 10     | place   | houses  | even        |              | :w-middle
221           | 11     | place   | houses  | even        | Cloud Street | :w-middle
222         And the place ways
223           | osm_id | class   | type     | name                    | geometry
224           | 2      | highway | tertiary | 'name' : 'Sun Way'      | :w-north
225           | 3      | highway | tertiary | 'name' : 'Cloud Street' | :w-south
226         And the ways
227           | id | nodes
228           | 10  | 1,100,101,102,2
229           | 11  | 3,200,201,202,4
230         When importing
231         Then table placex contains
232           | object | parent_place_id
233           | N1     | W2
234           | N2     | W2
235           | N3     | W3
236           | N4     | W3
237         Then table location_property_osmline contains
238           | object | parent_place_id | startnumber | endnumber
239           | W10    | W2              | 2           | 6
240           | W11    | W3              | 12          | 16
241         When sending query "16 Cloud Street"
242         Then results contain
243          | ID | osm_type | osm_id
244          | 0  | N        | 4
245         When sending query "14 Cloud Street"
246         Then results contain
247          | ID | osm_type | osm_id
248          | 0  | W        | 11
249         When sending query "18 Cloud Street"
250         Then results contain
251          | ID | osm_type | osm_id
252          | 0  | W        | 3
253
254     Scenario: addr:street on housenumber way
255         Given the scene parallel-road
256         And the place nodes
257           | osm_id | class | type  | housenumber | street       | geometry
258           | 1      | place | house | 2           |              | :n-middle-w
259           | 2      | place | house | 6           |              | :n-middle-e
260           | 3      | place | house | 12          | Cloud Street | :n-middle-w
261           | 4      | place | house | 16          | Cloud Street | :n-middle-e
262         And the place ways
263           | osm_id | class   | type    | housenumber | geometry
264           | 10     | place   | houses  | even        | :w-middle
265           | 11     | place   | houses  | even        | :w-middle
266         And the place ways
267           | osm_id | class   | type     | name                    | geometry
268           | 2      | highway | tertiary | 'name' : 'Sun Way'      | :w-north
269           | 3      | highway | tertiary | 'name' : 'Cloud Street' | :w-south
270         And the ways
271           | id  | nodes
272           | 10  | 1,100,101,102,2
273           | 11  | 3,200,201,202,4
274         When importing
275         Then table placex contains
276           | object | parent_place_id
277           | N1     | W2
278           | N2     | W2
279           | N3     | W3
280           | N4     | W3
281         And table location_property_osmline contains
282           | object | parent_place_id | startnumber | endnumber
283           | W10    | W2              | 2           | 6
284           | W11    | W3              | 12          | 16
285         When sending query "16 Cloud Street"
286         Then results contain
287          | ID | osm_type | osm_id
288          | 0  | N        | 4
289         When sending query "14 Cloud Street"
290         Then results contain
291          | ID | osm_type | osm_id
292          | 0  | W        | 11
293
294     Scenario: Geometry of points and way don't match (github #253)
295         Given the place nodes
296           | osm_id | class | type   | housenumber | geometry
297           | 1      | place | house  | 10          | 144.9632341 -37.76163
298           | 2      | place | house  | 6           | 144.9630541 -37.7628174
299           | 3      | shop  | supermarket | 2      | 144.9629794 -37.7630755
300         And the place ways
301           | osm_id | class | type   | housenumber | geometry
302           | 1      | place | houses | even        | 144.9632341 -37.76163,144.9630541 -37.7628172,144.9629794 -37.7630755
303         And the ways
304           | id | nodes
305           | 1  | 1,2,3
306         When importing
307         Then way 1 expands to lines
308           | startnumber | endnumber | geometry
309           | 2           | 6         | 144.9629794 -37.7630755, 144.9630541 -37.7628174
310           | 6           | 10        | 144.9630541 -37.7628174, 144.9632341 -37.76163
311
312     Scenario: Place with missing address information
313         Given the place nodes
314           | osm_id | class   | type   | housenumber | geometry
315           | 1      | place   | house  | 23          | 0.0001 0.0001
316           | 2      | amenity | school |             | 0.0001 0.0002
317           | 3      | place   | house  | 29          | 0.0001 0.0004
318         And the place ways
319           | osm_id | class | type   | housenumber | geometry
320           | 1      | place | houses | odd         | 0.0001 0.0001,0.0001 0.0002,0.0001 0.0004
321         And the ways
322           | id | nodes
323           | 1  | 1,2,3
324         When importing
325         Then way 1 expands to lines
326           | startnumber | endnumber | geometry
327           | 23          | 29        | 0.0001 0.0001, 0.0001 0.0002, 0.0001 0.0004