1 Feature: Import of postcodes
2 Tests for postcode estimation
4 Scenario: Postcodes on the object are preferred over those on the address
5 Given the grid with origin FR
6 | 1 | | | | 4 | | 6 | | 8 |
7 | | 10 | | 11 | | | | | |
9 | 2 | | | | 3 | | 5 | | 7 |
11 | osm | class | type | admin | addr+postcode | geometry |
12 | R1 | boundary | administrative | 6 | 10000 | (1,8,7,2,1) |
13 | R34 | boundary | administrative | 8 | 11000 | (1,6,5,2,1) |
14 | R4 | boundary | administrative | 10 | 11200 | (1,4,3,2,1) |
16 | osm | class | type | addr+postcode | geometry |
17 | W93 | highway | residential | 11250 | 10,11 |
18 | N22 | building | yes | 11254 | 22 |
28 Scenario: Postcodes from a road are inherited by an attached building
29 Given the grid with origin DE
34 | osm | class | type | addr+postcode | geometry |
35 | W93 | highway | residential | 86034 | 10,11 |
37 | osm | class | type | geometry |
38 | W22 | building | yes | (1,2,3,4,1) |
41 | object | postcode | parent_place_id |
44 Scenario: Postcodes from the lowest admin area are inherited by ways
45 Given the grid with origin FR
46 | 1 | | | | 4 | | 6 | | 8 |
47 | | 10 | | 11 | | | | | |
48 | 2 | | | | 3 | | 5 | | 7 |
50 | osm | class | type | admin | addr+postcode | geometry |
51 | R1 | boundary | administrative | 6 | 10000 | (1,8,7,2,1) |
52 | R34 | boundary | administrative | 8 | 11000 | (1,6,5,2,1) |
53 | R4 | boundary | administrative | 10 | 11200 | (1,4,3,2,1) |
55 | osm | class | type | geometry |
56 | W93 | highway | residential | 10,11 |
62 Scenario: Postcodes from the lowest admin area with postcode are inherited by ways
63 Given the grid with origin FR
64 | 1 | | | | 4 | | 6 | | 8 |
65 | | 10 | | 11 | | | | | |
66 | 2 | | | | 3 | | 5 | | 7 |
68 | osm | class | type | admin | addr+postcode | geometry |
69 | R1 | boundary | administrative | 6 | 10000 | (1,8,7,2,1) |
70 | R34 | boundary | administrative | 8 | 11000 | (1,6,5,2,1) |
72 | osm | class | type | admin | geometry |
73 | R4 | boundary | administrative | 10 | (1,4,3,2,1) |
75 | osm | class | type | geometry |
76 | W93 | highway | residential | 10,11 |
79 | object | postcode | parent_place_id |
82 Scenario: Postcodes from the lowest admin area are inherited by buildings
83 Given the grid with origin FR
84 | 1 | | | | 4 | | 6 | | 8 |
85 | | 10 | | 11 | | | | | |
86 | | 13 | | 12 | | | | | |
87 | 2 | | | | 3 | | 5 | | 7 |
89 | osm | class | type | admin | addr+postcode | geometry |
90 | R1 | boundary | administrative | 6 | 10000 | (1,8,7,2,1) |
91 | R34 | boundary | administrative | 8 | 11000 | (1,6,5,2,1) |
92 | R4 | boundary | administrative | 10 | 11200 | (1,4,3,2,1) |
94 | osm | class | type | geometry |
95 | W22 | building | yes | (10,11,12,13,10) |
101 Scenario: Roads get postcodes from nearby named buildings without other info
102 Given the grid with origin US
107 | osm | class | type | geometry |
108 | W93 | highway | residential | 10,11 |
110 | osm | class | type | addr+postcode | geometry |
111 | W22 | building | yes | 45023 | (1,2,3,4,1) |
114 | object | postcode |
117 Scenario: Road areas get postcodes from nearby named buildings without other info
118 Given the grid with origin US
124 | osm | class | type | geometry |
125 | W93 | highway | pedestrian | (10,11,12,13,10) |
127 | osm | class | type | addr+postcode | geometry |
128 | W22 | building | yes | 45023 | (1,2,3,4,1) |
131 | object | postcode |
134 Scenario: Roads get postcodes from nearby unnamed buildings without other info
135 Given the grid with origin US
139 | osm | class | type | geometry |
140 | W93 | highway | residential | 10,11 |
142 | osm | postcode | centroid |
146 | object | postcode |
149 Scenario: Postcodes from admin boundaries are preferred over estimated postcodes
150 Given the grid with origin FR
151 | 1 | | | | 4 | | 6 | | 8 |
152 | | 10 | | 11 | | | | | |
153 | | | 22 | | | | | | |
154 | 2 | | | | 3 | | 5 | | 7 |
156 | osm | class | type | admin | addr+postcode | geometry |
157 | R1 | boundary | administrative | 6 | 10000 | (1,8,7,2,1) |
158 | R34 | boundary | administrative | 8 | 11000 | (1,6,5,2,1) |
159 | R4 | boundary | administrative | 10 | 11200 | (1,4,3,2,1) |
161 | osm | class | type | geometry |
162 | W93 | highway | residential | 10,1 |
164 | osm | class | type | addr+postcode |
165 | N22 | building | yes | 45023 |
168 | object | postcode |
171 Scenario: Postcodes are added to the postcode
173 | osm | class | type | addr+postcode | addr+housenumber | geometry |
174 | N34 | place | house | 01982 | 111 | country:de |
176 Then location_postcodes contains exactly
177 | country_code | postcode | centroid!wkt |
178 | de | 01982 | country:de |
180 Scenario: Postcodes outside all countries are not added to the postcode table
182 | osm | class | type | addr+postcode | addr+housenumber | addr+place | geometry |
183 | N34 | place | house | 01982 | 111 | Null Island | 0 0.00001 |
185 | osm | class | type | name | geometry |
186 | N1 | place | hamlet | Null Island | 0 0 |
188 Then location_postcodes contains exactly
190 When geocoding "111, 01982 Null Island"
191 Then the result set contains
192 | object | display_name |
193 | N34 | 111, Null Island, 01982 |