2 Feature: Import of postcodes
3 Tests for postcode estimation
5 Scenario: Postcodes on the object are preferred over those on the address
6 Given the grid with origin FR
7 | 1 | | | | 4 | | 6 | | 8 |
8 | | 10 | | 11 | | | | | |
10 | 2 | | | | 3 | | 5 | | 7 |
12 | osm | class | type | admin | addr+postcode | geometry |
13 | R1 | boundary | administrative | 6 | 10000 | (1,8,7,2,1) |
14 | R34 | boundary | administrative | 8 | 11000 | (1,6,5,2,1) |
15 | R4 | boundary | administrative | 10 | 11200 | (1,4,3,2,1) |
17 | osm | class | type | addr+postcode | geometry |
18 | W93 | highway | residential | 11250 | 10,11 |
19 | N22 | building | yes | 11254 | 22 |
29 Scenario: Postcodes from a road are inherited by an attached building
30 Given the grid with origin DE
35 | osm | class | type | addr+postcode | geometry |
36 | W93 | highway | residential | 86034 | 10,11 |
38 | osm | class | type | geometry |
39 | W22 | building | yes | (1,2,3,4,1) |
42 | object | postcode | parent_place_id |
45 Scenario: Postcodes from the lowest admin area are inherited by ways
46 Given the grid with origin FR
47 | 1 | | | | 4 | | 6 | | 8 |
48 | | 10 | | 11 | | | | | |
49 | 2 | | | | 3 | | 5 | | 7 |
51 | osm | class | type | admin | addr+postcode | geometry |
52 | R1 | boundary | administrative | 6 | 10000 | (1,8,7,2,1) |
53 | R34 | boundary | administrative | 8 | 11000 | (1,6,5,2,1) |
54 | R4 | boundary | administrative | 10 | 11200 | (1,4,3,2,1) |
56 | osm | class | type | geometry |
57 | W93 | highway | residential | 10,11 |
63 Scenario: Postcodes from the lowest admin area with postcode are inherited by ways
64 Given the grid with origin FR
65 | 1 | | | | 4 | | 6 | | 8 |
66 | | 10 | | 11 | | | | | |
67 | 2 | | | | 3 | | 5 | | 7 |
69 | osm | class | type | admin | addr+postcode | geometry |
70 | R1 | boundary | administrative | 6 | 10000 | (1,8,7,2,1) |
71 | R34 | boundary | administrative | 8 | 11000 | (1,6,5,2,1) |
73 | osm | class | type | admin | geometry |
74 | R4 | boundary | administrative | 10 | (1,4,3,2,1) |
76 | osm | class | type | geometry |
77 | W93 | highway | residential | 10,11 |
80 | object | postcode | parent_place_id |
83 Scenario: Postcodes from the lowest admin area are inherited by buildings
84 Given the grid with origin FR
85 | 1 | | | | 4 | | 6 | | 8 |
86 | | 10 | | 11 | | | | | |
87 | | 13 | | 12 | | | | | |
88 | 2 | | | | 3 | | 5 | | 7 |
90 | osm | class | type | admin | addr+postcode | geometry |
91 | R1 | boundary | administrative | 6 | 10000 | (1,8,7,2,1) |
92 | R34 | boundary | administrative | 8 | 11000 | (1,6,5,2,1) |
93 | R4 | boundary | administrative | 10 | 11200 | (1,4,3,2,1) |
95 | osm | class | type | geometry |
96 | W22 | building | yes | (10,11,12,13,10) |
102 Scenario: Roads get postcodes from nearby named buildings without other info
103 Given the grid with origin US
108 | osm | class | type | geometry |
109 | W93 | highway | residential | 10,11 |
111 | osm | class | type | addr+postcode | geometry |
112 | W22 | building | yes | 45023 | (1,2,3,4,1) |
115 | object | postcode |
118 Scenario: Roads get postcodes from nearby unnamed buildings without other info
119 Given the grid with origin US
124 | osm | class | type | geometry |
125 | W93 | highway | residential | 10,11 |
127 | osm | class | type | addr+postcode | geometry |
128 | W22 | place | postcode | 45023 | (1,2,3,4,1) |
131 | object | postcode |
134 Scenario: Postcodes from admin boundaries are preferred over estimated postcodes
135 Given the grid with origin FR
136 | 1 | | | | 4 | | 6 | | 8 |
137 | | 10 | | 11 | | | | | |
138 | | | 22 | | | | | | |
139 | 2 | | | | 3 | | 5 | | 7 |
141 | osm | class | type | admin | addr+postcode | geometry |
142 | R1 | boundary | administrative | 6 | 10000 | (1,8,7,2,1) |
143 | R34 | boundary | administrative | 8 | 11000 | (1,6,5,2,1) |
144 | R4 | boundary | administrative | 10 | 11200 | (1,4,3,2,1) |
146 | osm | class | type | geometry |
147 | W93 | highway | residential | 10,1 |
149 | osm | class | type | addr+postcode |
150 | N22 | building | yes | 45023 |
153 | object | postcode |
156 Scenario: Postcodes are added to the postcode and word table
158 | osm | class | type | addr+postcode | addr+housenumber | geometry |
159 | N34 | place | house | 01982 | 111 |country:de |
161 Then location_postcode contains exactly
162 | country | postcode | geometry |
163 | de | 01982 | country:de |
164 And there are word tokens for postcodes 01982
168 Scenario: search and address ranks for GB post codes correctly assigned
170 | osm | class | type | postcode | geometry |
171 | N1 | place | postcode | E45 2CD | country:gb |
172 | N2 | place | postcode | E45 2 | country:gb |
173 | N3 | place | postcode | Y45 | country:gb |
175 Then location_postcode contains exactly
176 | postcode | country | rank_search | rank_address |
177 | E45 2CD | gb | 25 | 5 |
178 | E45 2 | gb | 23 | 5 |
179 | Y45 | gb | 21 | 5 |
182 Scenario: Postcodes outside all countries are not added to the postcode and word table
184 | osm | class | type | addr+postcode | addr+housenumber | addr+place | geometry |
185 | N34 | place | house | 01982 | 111 | Null Island | 0 0.00001 |
187 | osm | class | type | name | geometry |
188 | N1 | place | hamlet | Null Island | 0 0 |
190 Then location_postcode contains exactly
191 | country | postcode | geometry |
192 And there are no word tokens for postcodes 01982
193 When sending search query "111, 01982 Null Island"
195 | osm | display_name |
196 | N34 | 111, Null Island, 01982 |