]> git.openstreetmap.org Git - nominatim.git/blob - tests/features/db/import/interpolation.feature
1c05a882eb62564c317ae2b6ab436e52c296f9fc
[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
211     Scenario: addr:street on interpolation way
212         Given the scene parallel-road
213         And the place nodes
214           | osm_id | class | type  | housenumber | geometry
215           | 1      | place | house | 2           | :n-middle-w
216           | 2      | place | house | 6           | :n-middle-e
217           | 3      | place | house | 12          | :n-middle-w
218           | 4      | place | house | 16          | :n-middle-e
219         And the place ways
220           | osm_id | class   | type    | housenumber | street       | geometry
221           | 10     | place   | houses  | even        |              | :w-middle
222           | 11     | place   | houses  | even        | Cloud Street | :w-middle
223         And the place ways
224           | osm_id | class   | type     | name                    | geometry
225           | 2      | highway | tertiary | 'name' : 'Sun Way'      | :w-north
226           | 3      | highway | tertiary | 'name' : 'Cloud Street' | :w-south
227         And the ways
228           | id | nodes
229           | 10  | 1,100,101,102,2
230           | 11  | 3,200,201,202,4
231         When importing
232         Then table placex contains
233           | object | parent_place_id
234           | N1     | W2
235           | N2     | W2
236           | N3     | W3
237           | N4     | W3
238         Then table location_property_osmline contains
239           | object | parent_place_id | startnumber | endnumber
240           | W10    | W2              | 2           | 6
241           | W11    | W3              | 12          | 16
242
243     Scenario: addr:street on housenumber way
244         Given the scene parallel-road
245         And the place nodes
246           | osm_id | class | type  | housenumber | street       | geometry
247           | 1      | place | house | 2           |              | :n-middle-w
248           | 2      | place | house | 6           |              | :n-middle-e
249           | 3      | place | house | 12          | Cloud Street | :n-middle-w
250           | 4      | place | house | 16          | Cloud Street | :n-middle-e
251         And the place ways
252           | osm_id | class   | type    | housenumber | geometry
253           | 10     | place   | houses  | even        | :w-middle
254           | 11     | place   | houses  | even        | :w-middle
255         And the place ways
256           | osm_id | class   | type     | name                    | geometry
257           | 2      | highway | tertiary | 'name' : 'Sun Way'      | :w-north
258           | 3      | highway | tertiary | 'name' : 'Cloud Street' | :w-south
259         And the ways
260           | id  | nodes
261           | 10  | 1,100,101,102,2
262           | 11  | 3,200,201,202,4
263         When importing
264         Then table placex contains
265           | object | parent_place_id
266           | N1     | W2
267           | N2     | W2
268           | N3     | W3
269           | N4     | W3
270         And table location_property_osmline contains
271           | object | parent_place_id | startnumber | endnumber
272           | W10    | W2              | 2           | 6
273           | W11    | W3              | 12          | 16
274
275     Scenario: Geometry of points and way don't match (github #253)
276         Given the place nodes
277           | osm_id | class | type   | housenumber | geometry
278           | 1      | place | house  | 10          | 144.9632341 -37.76163
279           | 2      | place | house  | 6           | 144.9630541 -37.7628174
280           | 3      | shop  | supermarket | 2      | 144.9629794 -37.7630755
281         And the place ways
282           | osm_id | class | type   | housenumber | geometry
283           | 1      | place | houses | even        | 144.9632341 -37.76163,144.9630541 -37.7628172,144.9629794 -37.7630755
284         And the ways
285           | id | nodes
286           | 1  | 1,2,3
287         When importing
288         Then way 1 expands to lines
289           | startnumber | endnumber | geometry
290           | 2           | 6         | 144.9629794 -37.7630755, 144.9630541 -37.7628174
291           | 6           | 10        | 144.9630541 -37.7628174, 144.9632341 -37.76163
292
293     Scenario: Place with missing address information
294         Given the place nodes
295           | osm_id | class   | type   | housenumber | geometry
296           | 1      | place   | house  | 23          | 0.0001 0.0001
297           | 2      | amenity | school |             | 0.0001 0.0002
298           | 3      | place   | house  | 29          | 0.0001 0.0004
299         And the place ways
300           | osm_id | class | type   | housenumber | geometry
301           | 1      | place | houses | odd         | 0.0001 0.0001,0.0001 0.0002,0.0001 0.0004
302         And the ways
303           | id | nodes
304           | 1  | 1,2,3
305         When importing
306         Then way 1 expands to lines
307           | startnumber | endnumber | geometry
308           | 23          | 29        | 0.0001 0.0001, 0.0001 0.0002, 0.0001 0.0004