]> git.openstreetmap.org Git - nominatim.git/blob - test/bdd/db/import/interpolation.feature
Support housenumber=0 in interpolations
[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 places
7           | osm | class | type   | housenr | geometry |
8           | N1  | place | house  | 2       | 1 1 |
9           | N2  | place | house  | 6       | 1 1.001 |
10         And the places
11           | osm | class | type   | addr+interpolation | geometry |
12           | W1  | place | houses | even    | 1 1, 1 1.001 |
13         And the ways
14           | id | nodes |
15           | 1  | 1,2 |
16         When importing
17         Then W1 expands to interpolation
18           | start | end | geometry |
19           | 2     | 6   | 1 1, 1 1.001 |
20
21     Scenario: Backwards even two point interpolation line
22         Given the places
23           | osm | class | type   | housenr | geometry |
24           | N1  | place | house  | 2       | 1 1 |
25           | N2  | place | house  | 6       | 1 1.001 |
26         And the places
27           | osm | class | type   | addr+interpolation | geometry |
28           | W1  | place | houses | even    | 1 1.001, 1 1 |
29         And the ways
30           | id | nodes |
31           | 1  | 2,1 |
32         When importing
33         Then W1 expands to interpolation
34           | start | end | geometry |
35           | 2     | 6   | 1 1, 1 1.001 |
36
37     Scenario: Simple odd two point interpolation
38         Given the places
39           | osm | class | type   | housenr | geometry |
40           | N1  | place | house  | 1       | 1 1 |
41           | N2  | place | house  | 11      | 1 1.001 |
42         And the places
43           | osm | class | type   | addr+interpolation | geometry |
44           | W1  | place | houses | odd     | 1 1, 1 1.001 |
45         And the ways
46           | id | nodes |
47           | 1  | 1,2 |
48         When importing
49         Then W1 expands to interpolation
50           | start | end | geometry |
51           | 1     | 11  | 1 1, 1 1.001 |
52
53     Scenario: Simple all two point interpolation
54         Given the places
55           | osm | class | type   | housenr | geometry |
56           | N1  | place | house  | 1       | 1 1 |
57           | N2  | place | house  | 3       | 1 1.001 |
58         And the places
59           | osm | class | type   | addr+interpolation | geometry |
60           | W1  | place | houses | all     | 1 1, 1 1.001 |
61         And the ways
62           | id | nodes |
63           | 1  | 1,2 |
64         When importing
65         Then W1 expands to interpolation
66           | start | end | geometry |
67           | 1     | 3   | 1 1, 1 1.001 |
68
69     Scenario: Even two point interpolation line with intermediate empty node
70         Given the places
71           | osm | class | type   | housenr | geometry |
72           | N1  | place | house  | 2       | 1 1 |
73           | N2  | place | house  | 10      | 1.001 1.001 |
74         And the places
75           | osm | class | type   | addr+interpolation | geometry |
76           | W1  | 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 W1 expands to interpolation
82           | start | end | 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 places
87           | osm | class | type   | housenr | geometry |
88           | N1  | place | house  | 2       | 1 1 |
89           | N2  | place | house  | 10      | 1.001 1.001 |
90         And the places
91           | osm | class | type   | addr+interpolation | geometry |
92           | W1  | 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 W1 expands to interpolation
98           | start | end | 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 places
103           | osm | class | type   | housenr | geometry |
104           | N1  | place | house  | 2       | 1 1 |
105           | N2  | place | house  | 14      | 1.001 1.001 |
106           | N3  | place | house  | 10      | 1 1.001 |
107         And the places
108           | osm | class | type   | addr+interpolation | geometry |
109           | W1  | 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 W1 expands to interpolation
115           | start | end | 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 places
121           | osm | class | type  | housenr | geometry |
122           | N1  | place | house | 2       | 1 1 |
123           | N2  | place | house | 14      | 1.001 1.001 |
124           | N3  | place | house | 10      | 1 1.001 |
125           | N4  | place | house | 18      | 1.001 1.002 |
126         And the places
127           | osm | class | type   | addr+interpolation | geometry |
128           | W1  | 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 W1 expands to interpolation
134           | start | end | 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 places
141           | osm | class | type  | housenr | geometry |
142           | N1  | place | house | 2       | 1 1 |
143           | N2  | place | house | 14      | 1.001 1.001 |
144           | N3  | place | house | 10      | 1 1.001 |
145         And the places
146           | osm | class | type   | addr+interpolation | geometry |
147           | W1  | 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 W1 expands to interpolation
153           | start | end | 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 places
159           | osm | class | type  | housenr | geometry |
160           | N1  | place | house | 2       | 1 1 |
161           | N2  | place | house | 8       | 1.001 1.001 |
162           | N3  | place | house | 7       | 1 1.001 |
163         And the places
164           | osm | class | type   | addr+interpolation | geometry |
165           | W1  | 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 W1 expands to interpolation
171           | start | end | 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 places
177           | osm | class | type  | housenr | geometry |
178           | N1  | place | house | 2       | 0 0 |
179           | N2  | place | house | 6       | 0 0.001 |
180           | N3  | place | house | 10      | 0 0.002 |
181         And the places
182           | osm | class | type   | addr+interpolation | geometry |
183           | W1  | 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 W1 expands to interpolation
189           | start | end | 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 places
196           | osm | class | type  | housenr | geometry |
197           | N1  | place | house | 2       | 0 0 |
198           | N2  | place | house | 6       | 0 0.001 |
199         And the places
200           | osm | class | type   | addr+interpolation | geometry |
201           | W1  | 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 W1 expands to interpolation
207           | start | end | 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 places
213           | osm | class | type  | housenr | geometry |
214           | N1  | place | house | 2       | :n-middle-w |
215           | N2  | place | house | 6       | :n-middle-e |
216           | N3  | place | house | 12      | :n-middle-w |
217           | N4  | place | house | 16      | :n-middle-e |
218         And the places
219           | osm | class   | type    | addr+interpolation | street       | geometry |
220           | W10 | place   | houses  | even    |              | :w-middle |
221           | W11 | place   | houses  | even    | Cloud Street | :w-middle |
222         And the places
223           | osm | class   | type     | name         | geometry |
224           | W2  | highway | tertiary | Sun Way      | :w-north |
225           | W3  | highway | tertiary | 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 placex contains
232           | object | parent_place_id |
233           | N1     | W2 |
234           | N2     | W2 |
235           | N3     | W3 |
236           | N4     | W3 |
237         Then W10 expands to interpolation
238           | parent_place_id | start | end |
239           | W2              | 2     | 6 |
240         Then W11 expands to interpolation
241           | parent_place_id | start | end |
242           | W3              | 12    | 16 |
243         When searching for "16 Cloud Street"
244         Then results contain
245          | ID | osm_type | osm_id |
246          | 0  | N        | 4 |
247         When searching for "14 Cloud Street"
248         Then results contain
249          | ID | osm_type | osm_id |
250          | 0  | W        | 11 |
251
252     Scenario: addr:street on housenumber way
253         Given the scene parallel-road
254         And the places
255           | osm | class | type  | housenr | street       | geometry |
256           | N1  | place | house | 2       |              | :n-middle-w |
257           | N2  | place | house | 6       |              | :n-middle-e |
258           | N3  | place | house | 12      | Cloud Street | :n-middle-w |
259           | N4  | place | house | 16      | Cloud Street | :n-middle-e |
260         And the places
261           | osm | class   | type    | addr+interpolation | geometry |
262           | W10 | place   | houses  | even               | :w-middle |
263           | W11 | place   | houses  | even               | :w-middle |
264         And the places
265           | osm | class   | type     | name         | geometry |
266           | W2  | highway | tertiary | Sun Way      | :w-north |
267           | W3  | highway | tertiary | Cloud Street | :w-south |
268         And the ways
269           | id  | nodes |
270           | 10  | 1,100,101,102,2 |
271           | 11  | 3,200,201,202,4 |
272         When importing
273         Then placex contains
274           | object | parent_place_id |
275           | N1     | W2 |
276           | N2     | W2 |
277           | N3     | W3 |
278           | N4     | W3 |
279         Then W10 expands to interpolation
280           | parent_place_id | start | end |
281           | W2              | 2     | 6 |
282         Then W11 expands to interpolation
283           | parent_place_id | start | end |
284           | W3              | 12    | 16 |
285         When searching for "16 Cloud Street"
286         Then results contain
287          | ID | osm_type | osm_id |
288          | 0  | N        | 4 |
289         When searching for "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 places
296           | osm | class | type        | housenr | geometry |
297           | N1  | place | house       | 10      | 144.9632341 -37.76163 |
298           | N2  | place | house       | 6       | 144.9630541 -37.7628174 |
299           | N3  | shop  | supermarket | 2       | 144.9629794 -37.7630755 |
300         And the places
301           | osm | class | type   | addr+interpolation | geometry |
302           | W1  | 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 W1 expands to interpolation
308           | start | end | 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 grid
314           | 1 |  | 2 |  |  | 3 |
315         And the places
316           | osm | class   | type   | housenr |
317           | N1  | place   | house  | 23      |
318           | N2  | amenity | school |         |
319           | N3  | place   | house  | 29      |
320         And the places
321           | osm | class | type   | addr+interpolation | geometry |
322           | W1  | place | houses | odd                | 1,2,3 |
323         And the ways
324           | id | nodes |
325           | 1  | 1,2,3 |
326         When importing
327         Then W1 expands to interpolation
328           | start | end | geometry |
329           | 23    | 29  | 1,2,3 |
330
331     Scenario: Ways without node entries are ignored
332         Given the places
333           | osm | class | type   | housenr | geometry |
334           | W1  | place | houses | even    | 1 1, 1 1.001 |
335         When importing
336         Then W1 expands to no interpolation
337
338     Scenario: Ways without nodes without housenumbers are ignored
339         Given the places
340           | osm | class | type   | housenr | geometry |
341           | N1  | place | house  |         | 1 1 |
342           | N2  | place | house  |         | 1 1.001 |
343           | W1  | place | houses | even    | 1 1, 1 1.001 |
344         When importing
345         Then W1 expands to no interpolation
346
347     Scenario: Two point interpolation starting at 0
348         Given the places
349           | osm | class | type   | housenr | geometry |
350           | N1  | place | house  | 0       | 1 1 |
351           | N2  | place | house  | 2       | 1 1.001 |
352         And the places
353           | osm | class | type   | addr+interpolation | geometry |
354           | W1  | place | houses | even     | 1 1, 1 1.001 |
355         And the ways
356           | id | nodes |
357           | 1  | 1,2 |
358         When importing
359         Then W1 expands to interpolation
360           | start | end | geometry |
361           | 0     | 2   | 1 1, 1 1.001 |
362         When sending jsonv2 reverse coordinates 1,1
363         Then results contain
364           | ID | osm_type | osm_id | type  | display_name |
365           | 0  | way      | 1      | house | 0 |
366