]> git.openstreetmap.org Git - nominatim.git/blob - test/bdd/db/import/interpolation.feature
Merge pull request #2746 from bgo-eiu/patch-2
[nominatim.git] / test / bdd / 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 grid with origin 1,1
7           | 1 |  | 9 |  | 2 |
8         Given the places
9           | osm | class | type   | housenr |
10           | N1  | place | house  | 2       |
11           | N2  | place | house  | 6       |
12         And the places
13           | osm | class | type   | addr+interpolation | geometry |
14           | W1  | place | houses | even               | 1,2      |
15         And the ways
16           | id | nodes |
17           | 1  | 1,2 |
18         When importing
19         Then W1 expands to interpolation
20           | start | end | geometry |
21           | 4     | 4   | 9 |
22
23     Scenario: Backwards even two point interpolation line
24         Given the grid with origin 1,1
25           | 1 | 8 | 9 | 2 |
26         Given the places
27           | osm | class | type   | housenr |
28           | N1  | place | house  | 2       |
29           | N2  | place | house  | 8       |
30         And the places
31           | osm | class | type   | addr+interpolation | geometry |
32           | W1  | place | houses | even    | 1,2 |
33         And the ways
34           | id | nodes |
35           | 1  | 2,1 |
36         When importing
37         Then W1 expands to interpolation
38           | start | end | geometry |
39           | 4     | 6   | 8,9 |
40
41     Scenario: Simple odd two point interpolation
42         Given the grid with origin 1,1
43           | 1 | 8 |  |  | 9 | 2 |
44         Given the places
45           | osm | class | type   | housenr |
46           | N1  | place | house  | 1       |
47           | N2  | place | house  | 11      |
48         And the places
49           | osm | class | type   | addr+interpolation | geometry |
50           | W1  | place | houses | odd                | 1,2      |
51         And the ways
52           | id | nodes |
53           | 1  | 1,2 |
54         When importing
55         Then W1 expands to interpolation
56           | start | end | geometry |
57           | 3     | 9   | 8,9      |
58
59     Scenario: Simple all two point interpolation
60         Given the grid with origin 1,1
61           | 1 | 8 | 9 | 2 |
62         Given the places
63           | osm | class | type   | housenr |
64           | N1  | place | house  | 1       |
65           | N2  | place | house  | 4       |
66         And the places
67           | osm | class | type   | addr+interpolation | geometry |
68           | W1  | place | houses | all                | 1,2      |
69         And the ways
70           | id | nodes |
71           | 1  | 1,2 |
72         When importing
73         Then W1 expands to interpolation
74           | start | end | geometry |
75           | 2     | 3   | 8,9 |
76
77     Scenario: Even two point interpolation line with intermediate empty node
78         Given the grid
79           | 1 | 8 |  | 3 | 9 | 2 |
80         Given the places
81           | osm | class | type   | housenr |
82           | N1  | place | house  | 2       |
83           | N2  | place | house  | 12      |
84         And the places
85           | osm | class | type   | addr+interpolation | geometry |
86           | W1  | place | houses | even               | 1,3,2    |
87         And the ways
88           | id | nodes |
89           | 1  | 1,3,2 |
90         When importing
91         Then W1 expands to interpolation
92           | start | end | geometry |
93           | 4     | 10  | 8,3,9 |
94
95     Scenario: Even two point interpolation line with intermediate duplicated empty node
96         Given the grid
97           | 1 | 8 | 3 | 9 | 2 |
98         Given the places
99           | osm | class | type   | housenr |
100           | N1  | place | house  | 2       |
101           | N2  | place | house  | 10      |
102         And the places
103           | osm | class | type   | addr+interpolation | geometry |
104           | W1  | place | houses | even               | 1,3,2 |
105         And the ways
106           | id | nodes |
107           | 1  | 1,3,3,2 |
108         When importing
109         Then W1 expands to interpolation
110           | start | end | geometry |
111           | 4     | 8   | 8,3,9 |
112
113     Scenario: Simple even three point interpolation line
114         Given the grid
115           | 1 | 8 |  | 9 | 3 | 7 | 2 |
116         Given the places
117           | osm | class | type   | housenr |
118           | N1  | place | house  | 2       |
119           | N2  | place | house  | 14      |
120           | N3  | place | house  | 10      |
121         And the places
122           | osm | class | type   | addr+interpolation | geometry |
123           | W1  | place | houses | even               | 1,3,2    |
124         And the ways
125           | id | nodes |
126           | 1  | 1,3,2 |
127         When importing
128         Then W1 expands to interpolation
129           | start | end | geometry |
130           | 4     |  8  | 8,9 |
131           | 12    | 12  | 7 |
132
133     Scenario: Simple even four point interpolation line
134         Given the grid
135           | 1 | 10 |   | 11 | 3 |
136           |   |    |   |    | 12|
137           |   |    | 4 | 13 | 2 |
138         Given the places
139           | osm | class | type  | housenr |
140           | N1  | place | house | 2       |
141           | N2  | place | house | 14      |
142           | N3  | place | house | 10      |
143           | N4  | place | house | 18      |
144         And the places
145           | osm | class | type   | addr+interpolation | geometry |
146           | W1  | place | houses | even               | 1,3,2,4  |
147         And the ways
148           | id | nodes |
149           | 1  | 1,3,2,4 |
150         When importing
151         Then W1 expands to interpolation
152           | start | end | geometry |
153           | 4     | 8   | 10,11    |
154           | 12    | 12  | 12       |
155           | 16    | 16  | 13       |
156
157     Scenario: Reverse simple even three point interpolation line
158         Given the grid
159           | 1 | 8  |  | 9 | 3 | 7 | 2 |
160         Given the places
161           | osm | class | type  | housenr |
162           | N1  | place | house | 2       |
163           | N2  | place | house | 14      |
164           | N3  | place | house | 10      |
165         And the places
166           | osm | class | type   | addr+interpolation | geometry |
167           | W1  | place | houses | even               | 2,3,1    |
168         And the ways
169           | id | nodes |
170           | 1  | 2,3,1 |
171         When importing
172         Then W1 expands to interpolation
173           | start | end | geometry |
174           | 4     |  8  | 8,9      |
175           | 12    | 12  | 7        |
176
177     Scenario: Even three point interpolation line with odd center point
178         Given the grid
179           | 1 |  | 10 |  |  | 11 | 3 | 2 |
180         Given the places
181           | osm | class | type  | housenr |
182           | N1  | place | house | 2       |
183           | N2  | place | house | 8       |
184           | N3  | place | house | 7       |
185         And the places
186           | osm | class | type   | addr+interpolation | geometry |
187           | W1  | place | houses | even               | 1,3,2    |
188         And the ways
189           | id | nodes |
190           | 1  | 1,3,2 |
191         When importing
192         Then W1 expands to interpolation
193           | start | end | geometry |
194           | 4     | 6   | 10,11 |
195
196     Scenario: Interpolation line with self-intersecting way
197         Given the grid
198           | 1  | 9 | 2 |
199           |    |   | 8 |
200           |    |   | 3 |
201         Given the places
202           | osm | class | type  | housenr |
203           | N1  | place | house | 2       |
204           | N2  | place | house | 6       |
205           | N3  | place | house | 10      |
206         And the places
207           | osm | class | type   | addr+interpolation | geometry |
208           | W1  | place | houses | even               | 1,2,3,2  |
209         And the ways
210           | id | nodes |
211           | 1  | 1,2,3,2 |
212         When importing
213         Then W1 expands to interpolation
214           | start | end | geometry |
215           | 4     | 4   | 9        |
216           | 8     | 8   | 8        |
217           | 8     | 8   | 8        |
218
219     Scenario: Interpolation line with self-intersecting way II
220         Given the grid
221           | 1  | 9 | 2 |
222           |    |   | 3 |
223         Given the places
224           | osm | class | type  | housenr |
225           | N1  | place | house | 2       |
226           | N2  | place | house | 6       |
227         And the places
228           | osm | class | type   | addr+interpolation | geometry |
229           | W1  | place | houses | even               | 1,2,3,2  |
230         And the ways
231           | id | nodes |
232           | 1  | 1,2,3,2 |
233         When importing
234         Then W1 expands to interpolation
235           | start | end | geometry |
236           | 4     | 4   | 9        |
237
238     Scenario: addr:street on interpolation way
239         Given the grid
240           |    | 1 |  | 2 |    |
241           | 10 |   |  |   | 11 |
242           | 20 |   |  |   | 21 |
243         And the places
244           | osm | class | type  | housenr | geometry |
245           | N1  | place | house | 2       | 1        |
246           | N2  | place | house | 6       | 2        |
247           | N3  | place | house | 12      | 1        |
248           | N4  | place | house | 16      | 2        |
249         And the places
250           | osm | class   | type    | addr+interpolation | street       | geometry |
251           | W10 | place   | houses  | even               |              | 1,2      |
252           | W11 | place   | houses  | even               | Cloud Street | 1,2      |
253         And the places
254           | osm | class   | type     | name         | geometry |
255           | W2  | highway | tertiary | Sun Way      | 10,11    |
256           | W3  | highway | tertiary | Cloud Street | 20,21    |
257         And the ways
258           | id | nodes |
259           | 10 | 1,2   |
260           | 11 | 3,4   |
261         When importing
262         Then placex contains
263           | object | parent_place_id |
264           | N1     | W2 |
265           | N2     | W2 |
266           | N3     | W3 |
267           | N4     | W3 |
268         Then W10 expands to interpolation
269           | parent_place_id | start | end |
270           | W2              | 4     | 4 |
271         Then W11 expands to interpolation
272           | parent_place_id | start | end |
273           | W3              | 14    | 14 |
274         When sending search query "16 Cloud Street"
275         Then results contain
276          | ID | osm_type | osm_id |
277          | 0  | N        | 4 |
278         When sending search query "14 Cloud Street"
279         Then results contain
280          | ID | osm_type | osm_id |
281          | 0  | W        | 11 |
282
283     Scenario: addr:street on housenumber way
284         Given the grid
285           |    | 1 |  | 2 |    |
286           | 10 |   |  |   | 11 |
287           | 20 |   |  |   | 21 |
288         And the places
289           | osm | class | type  | housenr | street       | geometry |
290           | N1  | place | house | 2       |              | 1        |
291           | N2  | place | house | 6       |              | 2        |
292           | N3  | place | house | 12      | Cloud Street | 1        |
293           | N4  | place | house | 16      | Cloud Street | 2        |
294         And the places
295           | osm | class   | type    | addr+interpolation | geometry |
296           | W10 | place   | houses  | even               | 1,2      |
297           | W11 | place   | houses  | even               | 1,2      |
298         And the places
299           | osm | class   | type     | name         | geometry |
300           | W2  | highway | tertiary | Sun Way      | 10,11    |
301           | W3  | highway | tertiary | Cloud Street | 20,21    |
302         And the ways
303           | id  | nodes |
304           | 10  | 1,2 |
305           | 11  | 3,4 |
306         When importing
307         Then placex contains
308           | object | parent_place_id |
309           | N1     | W2 |
310           | N2     | W2 |
311           | N3     | W3 |
312           | N4     | W3 |
313         Then W10 expands to interpolation
314           | parent_place_id | start | end |
315           | W2              | 4     | 4 |
316         Then W11 expands to interpolation
317           | parent_place_id | start | end |
318           | W3              | 14    | 14 |
319         When sending search query "16 Cloud Street"
320         Then results contain
321          | ID | osm_type | osm_id |
322          | 0  | N        | 4 |
323         When sending search query "14 Cloud Street"
324         Then results contain
325          | ID | osm_type | osm_id |
326          | 0  | W        | 11 |
327
328     Scenario: Geometry of points and way don't match (github #253)
329         Given the places
330           | osm | class | type        | housenr | geometry |
331           | N1  | place | house       | 10      | 144.9632341 -37.76163 |
332           | N2  | place | house       | 6       | 144.9630541 -37.7628174 |
333           | N3  | shop  | supermarket | 2       | 144.9629794 -37.7630755 |
334         And the places
335           | osm | class | type   | addr+interpolation | geometry |
336           | W1  | place | houses | even    | 144.9632341 -37.76163,144.9630541 -37.7628172,144.9629794 -37.7630755 |
337         And the ways
338           | id | nodes |
339           | 1  | 1,2,3 |
340         When importing
341         Then W1 expands to interpolation
342           | start | end | geometry |
343           | 4     | 4   | 144.963016 -37.762946 |
344           | 8     | 8   | 144.963144 -37.7622237 |
345
346     Scenario: Place with missing address information
347         Given the grid
348           | 1 |  | 2 |  |  | 3 |
349         And the places
350           | osm | class   | type   | housenr |
351           | N1  | place   | house  | 23      |
352           | N2  | amenity | school |         |
353           | N3  | place   | house  | 29      |
354         And the places
355           | osm | class | type   | addr+interpolation | geometry |
356           | W1  | place | houses | odd                | 1,2,3 |
357         And the ways
358           | id | nodes |
359           | 1  | 1,2,3 |
360         When importing
361         Then W1 expands to interpolation
362           | start | end | geometry |
363           | 25    | 27  | 0.000016 0,0.00002 0,0.000033 0 |
364
365     Scenario: Ways without node entries are ignored
366         Given the places
367           | osm | class | type   | housenr | geometry |
368           | W1  | place | houses | even    | 1 1, 1 1.001 |
369         When importing
370         Then W1 expands to no interpolation
371
372     Scenario: Ways with nodes without housenumbers are ignored
373         Given the grid
374           | 1  |  |  2 |
375         Given the places
376           | osm | class | type   |
377           | N1  | place | house  |
378           | N2  | place | house  |
379         Given the places
380           | osm | class | type   | housenr | geometry |
381           | W1  | place | houses | even    | 1,2 |
382         When importing
383         Then W1 expands to no interpolation
384
385     Scenario: Two point interpolation starting at 0
386         Given the grid with origin 1,1
387           | 1 | 10 |  |  | 11 | 2 |
388         Given the places
389           | osm | class | type   | housenr |
390           | N1  | place | house  | 0       |
391           | N2  | place | house  | 10      |
392         And the places
393           | osm | class | type   | addr+interpolation | geometry |
394           | W1  | place | houses | even               | 1,2      |
395         And the ways
396           | id | nodes |
397           | 1  | 1,2 |
398         When importing
399         Then W1 expands to interpolation
400           | start | end | geometry |
401           | 2     | 8   | 10,11 |
402         When sending jsonv2 reverse coordinates 1,1
403         Then results contain
404           | ID | osm_type | osm_id | type  | display_name |
405           | 0  | node     | 1      | house | 0 |