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