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 | pedestriant | (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
140 | osm | class | type | geometry |
141 | W93 | highway | residential | 10,11 |
143 | osm | class | type | addr+postcode | geometry |
144 | W22 | place | postcode | 45023 | (1,2,3,4,1) |
147 | object | postcode |
150 Scenario: Postcodes from admin boundaries are preferred over estimated postcodes
151 Given the grid with origin FR
152 | 1 | | | | 4 | | 6 | | 8 |
153 | | 10 | | 11 | | | | | |
154 | | | 22 | | | | | | |
155 | 2 | | | | 3 | | 5 | | 7 |
157 | osm | class | type | admin | addr+postcode | geometry |
158 | R1 | boundary | administrative | 6 | 10000 | (1,8,7,2,1) |
159 | R34 | boundary | administrative | 8 | 11000 | (1,6,5,2,1) |
160 | R4 | boundary | administrative | 10 | 11200 | (1,4,3,2,1) |
162 | osm | class | type | geometry |
163 | W93 | highway | residential | 10,1 |
165 | osm | class | type | addr+postcode |
166 | N22 | building | yes | 45023 |
169 | object | postcode |
172 Scenario: Postcodes are added to the postcode
174 | osm | class | type | addr+postcode | addr+housenumber | geometry |
175 | N34 | place | house | 01982 | 111 |country:de |
177 Then location_postcode contains exactly
178 | country_code | postcode | geometry!wkt |
179 | de | 01982 | country:de |
182 Scenario: search and address ranks for GB post codes correctly assigned
184 | osm | class | type | postcode | geometry |
185 | N1 | place | postcode | E45 2CD | country:gb |
186 | N2 | place | postcode | E45 2 | country:gb |
187 | N3 | place | postcode | Y45 | country:gb |
189 Then location_postcode contains exactly
190 | postcode | country_code | rank_search | rank_address |
191 | E45 2CD | gb | 25 | 5 |
192 | E45 2 | gb | 23 | 5 |
193 | Y45 | gb | 21 | 5 |
195 Scenario: Postcodes outside all countries are not added to the postcode table
197 | osm | class | type | addr+postcode | addr+housenumber | addr+place | geometry |
198 | N34 | place | house | 01982 | 111 | Null Island | 0 0.00001 |
200 | osm | class | type | name | geometry |
201 | N1 | place | hamlet | Null Island | 0 0 |
203 Then location_postcode contains exactly
205 When geocoding "111, 01982 Null Island"
206 Then the result set contains
207 | object | display_name |
208 | N34 | 111, Null Island, 01982 |