]> git.openstreetmap.org Git - nominatim.git/blob - test/bdd/features/db/import/interpolation.feature
prepare release 5.3.2-post1
[nominatim.git] / test / bdd / features / db / import / interpolation.feature
1 Feature: Import of address interpolations
2     Tests that interpolated addresses are added correctly
3
4     Scenario: Simple even interpolation line with two points and no street nearby
5         Given the grid with origin 1,1
6           | 1 |  | 9 |  | 2 |
7         Given the places
8           | osm | class | type   | housenr |
9           | N1  | place | house  | 2       |
10           | N2  | place | house  | 6       |
11         And the interpolations
12           | osm | type | geometry | nodes |
13           | W1  | even | 1,2      | 1,2   |
14         When importing
15         Then W1 expands to no interpolation
16
17     Scenario: Simple even interpolation line with two points
18         Given the grid with origin 1,1
19           | 1 |  | 9 |  | 2 |
20           | 4 |  |   |  | 5 |
21         Given the places
22           | osm | class | type   | housenr |
23           | N1  | place | house  | 2       |
24           | N2  | place | house  | 6       |
25         And the interpolations
26           | osm | type | geometry | nodes |
27           | W1  | even | 1,2      | 1,2   |
28         And the named places
29           | osm | class   | type        | geometry |
30           | W10 | highway | residential | 4,5      |
31         When importing
32         Then W1 expands to interpolation
33           | start | end | geometry |
34           | 4     | 4   | 9 |
35
36     Scenario: Backwards even two point interpolation line
37         Given the grid with origin 1,1
38           | 1 | 8 | 9 | 2 |
39           | 4 |   |   | 5 |
40         Given the places
41           | osm | class | type   | housenr |
42           | N1  | place | house  | 2       |
43           | N2  | place | house  | 8       |
44         And the interpolations
45           | osm | type | geometry | nodes |
46           | W1  | even | 2,1      | 2,1   |
47         And the named places
48           | osm | class   | type        | geometry |
49           | W10 | highway | residential | 4,5      |
50         When importing
51         Then W1 expands to interpolation
52           | start | end | geometry |
53           | 4     | 6   | 8,9      |
54
55     Scenario: Simple odd two point interpolation
56         Given the grid with origin 1,1
57           | 1 | 8 |  |  | 9 | 2 |
58           | 4 |   |  |  | 5 |   |
59         Given the places
60           | osm | class | type   | housenr |
61           | N1  | place | house  | 1       |
62           | N2  | place | house  | 11      |
63         And the interpolations
64           | osm | type | geometry | nodes |
65           | W1  | odd  | 1,2      | 1,2   |
66         And the named places
67           | osm | class   | type        | geometry |
68           | W10 | highway | residential | 4,5      |
69         When importing
70         Then W1 expands to interpolation
71           | start | end | geometry |
72           | 3     | 9   | 8,9      |
73
74     Scenario: Simple all two point interpolation
75         Given the grid with origin 1,1
76           | 1 | 8 | 9 | 2 |
77           | 4 |   |   | 5 |
78         Given the places
79           | osm | class | type   | housenr |
80           | N1  | place | house  | 1       |
81           | N2  | place | house  | 4       |
82         And the interpolations
83           | osm | type | geometry | nodes |
84           | W1  | all  | 1,2      | 1,2 |
85         And the named places
86           | osm | class   | type        | geometry |
87           | W10 | highway | residential | 4,5      |
88         When importing
89         Then W1 expands to interpolation
90           | start | end | geometry |
91           | 2     | 3   | 8,9 |
92
93     Scenario: Even two point interpolation line with intermediate empty node
94         Given the grid
95           | 1 | 8 |  | 3 | 9 | 2 |
96           | 4 |   |  |   | 5 |   |
97         Given the places
98           | osm | class | type   | housenr |
99           | N1  | place | house  | 2       |
100           | N2  | place | house  | 12      |
101         And the interpolations
102           | osm | type | geometry | nodes |
103           | W1  | even | 1,3,2    | 1,3,2 |
104         And the named places
105           | osm | class   | type        | geometry |
106           | W10 | highway | residential | 4,5      |
107         When importing
108         Then W1 expands to interpolation
109           | start | end | geometry |
110           | 4     | 10  | 8,3,9 |
111
112     Scenario: Even two point interpolation line with intermediate duplicated empty node
113         Given the grid
114           | 4 |   |   |   | 5 |
115           | 1 | 8 | 3 | 9 | 2 |
116         Given the places
117           | osm | class | type   | housenr |
118           | N1  | place | house  | 2       |
119           | N2  | place | house  | 10      |
120         And the interpolations
121           | osm | type | geometry | nodes |
122           | W1  | even | 1,3,2    | 1,3,3,2 |
123         And the named places
124           | osm | class   | type        | geometry |
125           | W10 | highway | residential | 4,5      |
126         When importing
127         Then W1 expands to interpolation
128           | start | end | geometry |
129           | 4     | 8   | 8,3,9 |
130
131     Scenario: Simple even three point interpolation line
132         Given the grid
133           | 4 |   |  |   |   |   | 5 |
134           | 1 | 8 |  | 9 | 3 | 7 | 2 |
135         Given the places
136           | osm | class | type   | housenr |
137           | N1  | place | house  | 2       |
138           | N2  | place | house  | 14      |
139           | N3  | place | house  | 10      |
140         And the interpolations
141           | osm | type | geometry | nodes |
142           | W1  | even | 1,3,2    | 1,3,2 |
143         And the named places
144           | osm | class   | type        | geometry |
145           | W10 | highway | residential | 4,5      |
146         When importing
147         Then W1 expands to interpolation
148           | start | end | geometry |
149           | 4     |  8  | 8,9 |
150           | 12    | 12  | 7 |
151
152     Scenario: Simple even four point interpolation line
153         Given the grid
154           | 1 | 10 |   | 11 | 3 |
155           |   |    |   |    | 12|
156           |   |    | 4 | 13 | 2 |
157         Given the places
158           | osm | class | type  | housenr |
159           | N1  | place | house | 2       |
160           | N2  | place | house | 14      |
161           | N3  | place | house | 10      |
162           | N4  | place | house | 18      |
163         And the interpolations
164           | osm | type | geometry | nodes |
165           | W1  | even | 1,3,2,4  | 1,3,2,4 |
166         And the named places
167           | osm | class   | type        | geometry |
168           | W10 | highway | residential | 1,3,2,4  |
169         When importing
170         Then W1 expands to interpolation
171           | start | end | geometry |
172           | 4     | 8   | 10,11    |
173           | 12    | 12  | 12       |
174           | 16    | 16  | 13       |
175
176     Scenario: Reverse simple even three point interpolation line
177         Given the grid
178           | 1 | 8  |  | 9 | 3 | 7 | 2 |
179           | 4 |    |  |   |   |   | 5 |
180         Given the places
181           | osm | class | type  | housenr |
182           | N1  | place | house | 2       |
183           | N2  | place | house | 14      |
184           | N3  | place | house | 10      |
185         And the interpolations
186           | osm | type | geometry | nodes |
187           | W1  | even | 2,3,1    | 2,3,1 |
188         And the named places
189           | osm | class   | type        | geometry |
190           | W10 | highway | residential | 4,5      |
191         When importing
192         Then W1 expands to interpolation
193           | start | end | geometry |
194           | 4     |  8  | 8,9      |
195           | 12    | 12  | 7        |
196
197     Scenario: Even three point interpolation line with odd center point
198         Given the grid
199           | 1 |  | 10 |  | 11 | 3 | 2 |
200           | 4 |  |    |  |    |   | 5 |
201         Given the places
202           | osm | class | type  | housenr |
203           | N1  | place | house | 2       |
204           | N2  | place | house | 8       |
205           | N3  | place | house | 7       |
206         And the interpolations
207           | osm | type | geometry | nodes |
208           | W1  | even | 1,3,2    | 1,3,2 |
209         And the named places
210           | osm | class   | type        | geometry |
211           | W10 | highway | residential | 4,5      |
212         When importing
213         Then W1 expands to interpolation
214           | start | end | geometry |
215           | 4     | 6   | 10,11 |
216
217     Scenario: Interpolation line with self-intersecting way
218         Given the grid
219           | 1  | 9 | 2 |
220           |    |   | 8 |
221           |    |   | 3 |
222         Given the places
223           | osm | class | type  | housenr |
224           | N1  | place | house | 2       |
225           | N2  | place | house | 6       |
226           | N3  | place | house | 10      |
227         And the interpolations
228           | osm | type | geometry | nodes |
229           | W1  | even | 1,2,3,2  | 1,2,3,2 |
230         And the named places
231           | osm | class   | type        | geometry |
232           | W10 | highway | residential | 1,2,3    |
233         When importing
234         Then W1 expands to interpolation
235           | start | end | geometry |
236           | 4     | 4   | 9        |
237           | 8     | 8   | 8        |
238           | 8     | 8   | 8        |
239
240     Scenario: Interpolation line with self-intersecting way II
241         Given the grid
242           | 1  | 9 | 2 |
243           |    |   | 3 |
244         Given the places
245           | osm | class | type  | housenr |
246           | N1  | place | house | 2       |
247           | N2  | place | house | 6       |
248         And the interpolations
249           | osm | type | geometry | nodes |
250           | W1  | even | 1,2,3,2  | 1,2,3,2 |
251         And the named places
252           | osm | class   | type        | geometry |
253           | W10 | highway | residential | 1,2,3    |
254         When importing
255         Then W1 expands to interpolation
256           | start | end | geometry |
257           | 4     | 4   | 9        |
258
259     Scenario: addr:street on interpolation way
260         Given the grid
261           |    | 1 |  | 2 |    |
262           | 10 |   |  |   | 11 |
263           | 20 |   |  |   | 21 |
264         And the places
265           | osm | class | type  | housenr | geometry |
266           | N1  | place | house | 2       | 1        |
267           | N2  | place | house | 6       | 2        |
268           | N3  | place | house | 12      | 1        |
269           | N4  | place | house | 16      | 2        |
270         And the interpolations
271           | osm | type | street       | nodes | geometry | nodes |
272           | W10 | even |              | 1,2   | 1,2      | 1,2   |
273           | W11 | even | Cloud Street | 3,4   | 1,2      | 3,4   |
274         And the places
275           | osm | class   | type     | name         | geometry |
276           | W2  | highway | tertiary | Sun Way      | 10,11    |
277           | W3  | highway | tertiary | Cloud Street | 20,21    |
278         When importing
279         Then placex contains
280           | object | parent_place_id |
281           | N1     | W2 |
282           | N2     | W2 |
283           | N3     | W3 |
284           | N4     | W3 |
285         Then W10 expands to interpolation
286           | parent_place_id | start | end |
287           | W2              | 4     | 4 |
288         Then W11 expands to interpolation
289           | parent_place_id | start | end |
290           | W3              | 14    | 14 |
291         When geocoding "16 Cloud Street"
292         Then result 0 contains
293          | object |
294          | N4  |
295         When geocoding "14 Cloud Street"
296         Then result 0 contains
297          | object |
298          | W11 |
299
300     Scenario: addr:street on housenumber way
301         Given the grid
302           |    | 1 |  | 2 |    |
303           | 10 |   |  |   | 11 |
304           | 20 |   |  |   | 21 |
305         And the places
306           | osm | class | type  | housenr | street       | geometry |
307           | N1  | place | house | 2       |              | 1        |
308           | N2  | place | house | 6       |              | 2        |
309           | N3  | place | house | 12      | Cloud Street | 1        |
310           | N4  | place | house | 16      | Cloud Street | 2        |
311         And the interpolations
312           | osm | type | geometry | nodes |
313           | W10 | even | 1,2      | 1,2 |
314           | W11 | even | 1,2      | 3,4 |
315         And the places
316           | osm | class   | type     | name         | geometry |
317           | W2  | highway | tertiary | Sun Way      | 10,11    |
318           | W3  | highway | tertiary | Cloud Street | 20,21    |
319         When importing
320         Then placex contains
321           | object | parent_place_id |
322           | N1     | W2 |
323           | N2     | W2 |
324           | N3     | W3 |
325           | N4     | W3 |
326         Then W10 expands to interpolation
327           | parent_place_id | start | end |
328           | W2              | 4     | 4 |
329         Then W11 expands to interpolation
330           | parent_place_id | start | end |
331           | W3              | 14    | 14 |
332         When geocoding "16 Cloud Street"
333         Then result 0 contains
334          | object |
335          | N4  |
336         When geocoding "14 Cloud Street"
337         Then result 0 contains
338          | object |
339          | W11 |
340
341     Scenario: Geometry of points and way don't match (github #253)
342         Given the places
343           | osm | class | type        | housenr | geometry |
344           | N1  | place | house       | 10      | 144.9632341 -37.76163 |
345           | N2  | place | house       | 6       | 144.9630541 -37.7628174 |
346           | N3  | shop  | supermarket | 2       | 144.9629794 -37.7630755 |
347         And the interpolations
348           | osm | type | geometry                                                              | nodes |
349           | W1  | even | 144.9632341 -37.76163,144.9630541 -37.7628172,144.9629794 -37.7630755 | 1,2,3 |
350         And the named places
351           | osm | class   | type        | geometry |
352           | W10 | highway | residential | 144.9632341 -37.76163,144.9629794 -37.7630755    |
353         When importing
354         Then W1 expands to interpolation
355           | start | end | geometry |
356           | 4     | 4   | 144.96301672 -37.76294644 |
357           | 8     | 8   | 144.96314407 -37.762223692 |
358
359     Scenario: Place with missing address information
360         Given the grid
361           | 1 |  | 2 |  |  | 3 |
362           | 4 |  |   |  |  | 5 |
363         And the places
364           | osm | class   | type   | housenr |
365           | N1  | place   | house  | 23      |
366           | N2  | amenity | school |         |
367           | N3  | place   | house  | 29      |
368         And the interpolations
369           | osm | type | geometry | nodes |
370           | W1  | odd  | 1,2,3    | 1,2,3 |
371         And the named places
372           | osm | class   | type        | geometry |
373           | W10 | highway | residential | 4,5      |
374         When importing
375         Then W1 expands to interpolation
376           | start | end | geometry |
377           | 25    | 27  | 0.0000166 0,0.00002 0,0.0000333 0 |
378
379     Scenario: Ways without node entries are ignored
380         Given the interpolations
381           | osm | type | geometry     | nodes |
382           | W1  | even | 1 1, 1 1.001 | 34,45 |
383         And the named places
384           | osm | class   | type        | geometry |
385           | W10 | highway | residential | 1 1, 1 1.001 |
386         When importing
387         Then W1 expands to no interpolation
388
389     Scenario: Ways with nodes without housenumbers are ignored
390         Given the grid
391           | 1 |  | 2 |
392           | 4 |  | 5 |
393         Given the places
394           | osm | class | type   |
395           | N1  | place | house  |
396           | N2  | place | house  |
397         Given the interpolations
398           | osm | type | geometry | nodes |
399           | W1  | even | 1,2      | 1,2   |
400         And the named places
401           | osm | class   | type        | geometry |
402           | W10 | highway | residential | 4,5      |
403         When importing
404         Then W1 expands to no interpolation
405
406     Scenario: Two point interpolation starting at 0
407         Given the grid with origin 1,1
408           | 1 | 10 |  |  | 11 | 2 |
409           | 4 |    |  |  |    | 5 |
410         Given the places
411           | osm | class | type   | housenr |
412           | N1  | place | house  | 0       |
413           | N2  | place | house  | 10      |
414         And the interpolations
415           | osm | type | geometry | nodes |
416           | W1  | even | 1,2      | 1,2 |
417         And the places
418           | osm | class   | type        | name        | geometry |
419           | W10 | highway | residential | London Road |4,5      |
420         When importing
421         Then W1 expands to interpolation
422           | start | end | geometry |
423           | 2     | 8   | 10,11 |
424         When reverse geocoding 1,1
425         Then the result contains
426           | object | type  | display_name |
427           | N1     | house | 0, London Road |
428
429     Scenario: Parenting of interpolation with additional tags
430         Given the grid
431           | 1 |   |   |   |   |   |
432           |   |   |   |   |   |   |
433           |   | 8 |   |   | 9 |   |
434           |   |   |   |   |   |   |
435           | 2 |   |   |   |   | 3 |
436         Given the places
437           | osm | class | type  | housenr | addr+street |
438           | N8  | place | house | 10      | Horiz St    |
439           | N9  | place | house | 16      | Horiz St    |
440         And the places
441           | osm | class   | type        | name     | geometry |
442           | W1  | highway | residential | Vert St  | 1,2      |
443           | W2  | highway | residential | Horiz St | 2,3      |
444         And the interpolations
445           | osm | type | addr+inclusion | geometry | nodes |
446           | W10 | even | actual         | 8,9      | 8,9   |
447         When importing
448         Then placex contains
449           | object | parent_place_id |
450           | N8     | W2              |
451           | N9     | W2              |
452         And W10 expands to interpolation
453           | start | end | parent_place_id |
454           | 12    | 14  | W2              |
455
456
457     Scenario Outline: Bad interpolation values are ignored
458         Given the grid with origin 1,1
459           | 1 |  | 9 |  | 2 |
460           | 4 |  |   |  | 5 |
461         Given the places
462           | osm | class | type   | housenr |
463           | N1  | place | house  | 2       |
464           | N2  | place | house  | 6       |
465         And the interpolations
466           | osm | type    | geometry | nodes |
467           | W1  | <value> | 1,2      | 1,2 |
468         And the named places
469           | osm | class   | type        | geometry |
470           | W10 | highway | residential | 4,5      |
471         When importing
472         Then W1 expands to no interpolation
473
474         Examples:
475           | value |
476           | foo   |
477           | x     |
478           | 12-2  |
479
480
481     Scenario: Interpolation line where points have been moved (Github #3022)
482         Given the 0.00001 grid
483          | 1 | | | | | | | | 2 | 3 | 9 | | | | | | | | 4 |
484         Given the places
485           | osm | class | type   | housenr | geometry |
486           | N1  | place | house  | 2       | 1 |
487           | N2  | place | house  | 18      | 3 |
488           | N3  | place | house  | 24      | 9 |
489           | N4  | place | house  | 42      | 4 |
490         And the interpolations
491           | osm | type | geometry | nodes   |
492           | W1  | even | 1,2,3,4  | 1,2,3,4 |
493         And the named places
494           | osm | class   | type        | geometry |
495           | W10 | highway | residential | 1,4      |
496         When importing
497         Then W1 expands to interpolation
498           | start | end |
499           | 4     | 16  |
500           | 20    | 22  |
501           | 26    | 40  |
502
503
504     Scenario: Interpolation line with duplicated points
505         Given the grid
506           | 7 | 10 | 8 | 11 | 9 |
507           | 4 |    |   |    | 5 |
508         Given the places
509           | osm | class | type   | housenr | geometry |
510           | N1  | place | house  | 2       | 7 |
511           | N2  | place | house  | 6       | 8 |
512           | N3  | place | house  | 10      | 8 |
513           | N4  | place | house  | 14      | 9 |
514         And the interpolations
515           | osm | type | geometry | nodes   |
516           | W1  | even | 7,8,8,9  | 1,2,3,4 |
517         And the named places
518           | osm | class   | type        | geometry |
519           | W10 | highway | residential | 4,5      |
520         When importing
521         Then W1 expands to interpolation
522           | start | end | geometry |
523           | 4     | 4   | 10       |
524           | 12    | 12  | 11       |
525
526
527     Scenario: Interpolaton line with broken way geometry (Github #2986)
528         Given the grid
529           | 1 | 8 | 10 | 11 | 9 | 2 | 3 | 4 |
530         Given the places
531           | osm | class | type   | housenr |
532           | N1  | place | house  | 2       |
533           | N2  | place | house  | 8       |
534           | N3  | place | house  | 12      |
535           | N4  | place | house  | 14      |
536         And the interpolations
537           | osm | type | geometry | nodes       |
538           | W1  | even | 8,9      | 1,8,9,2,3,4 |
539         And the named places
540           | osm | class   | type        | geometry |
541           | W10 | highway | residential | 1,4      |
542         When importing
543         Then W1 expands to interpolation
544           | start | end | geometry |
545           | 4     | 6   | 10,11    |