]> git.openstreetmap.org Git - nominatim.git/blob - test/bdd/db/import/postcodes.feature
add simple tests for postcode import
[nominatim.git] / test / bdd / db / import / postcodes.feature
1 @DB
2 Feature: Import of postcodes
3     Tests for postcode estimation
4
5     Scenario: Postcodes on the object are prefered over those on the address
6         Given the scene admin-areas
7         And the named places
8             | osm | class    | type           | admin | addr+postcode | geometry |
9             | R1  | boundary | administrative | 6     | 112           | :b0      |
10             | R34 | boundary | administrative | 8     | 112 DE        | :b1:E    |
11             | R4  | boundary | administrative | 10    | 112 DE 34     | :b2:N    |
12         And the named places
13             | osm | class    | type        | addr+postcode | geometry |
14             | W93 | highway  | residential | 112 DE 344    | :w2N     |
15             | W22 | building | yes         | 112 DE 344N   | :building:w2N |
16         When importing
17         Then placex contains
18             | object | postcode    |
19             | W22    | 112 DE 344N |
20             | W93    | 112 DE 344  |
21             | R4     | 112 DE 34   |
22             | R34    | 112 DE      |
23             | R1     | 112         |
24
25     Scenario: Postcodes from a road are inherited by an attached building
26         Given the scene admin-areas
27         And the named places
28             | osm | class    | type        | addr+postcode | geometry |
29             | W93 | highway  | residential | 86034         | :w2N     |
30         And the named places
31             | osm | class    | type  | geometry |
32             | W22 | building | yes   | :building:w2N |
33         When importing
34         Then placex contains
35             | object | postcode | parent_place_id |
36             | W22    | 86034    | W93 |
37
38     Scenario: Postcodes from the lowest admin area are inherited by ways
39         Given the scene admin-areas
40         And the named places
41             | osm | class    | type           | admin | addr+postcode | geometry |
42             | R1  | boundary | administrative | 6     | 112           | :b0      |
43             | R34 | boundary | administrative | 8     | 112 DE        | :b1:E    |
44             | R4  | boundary | administrative | 10    | 112 DE 34     | :b2:N    |
45         And the named places
46             | osm | class    | type           | geometry |
47             | W93 | highway  | residential    | :w2N     |
48         When importing
49         Then placex contains
50             | object | postcode  |
51             | W93    | 112 DE 34 |
52
53     Scenario: Postcodes from the lowest admin area with postcode are inherited by ways
54         Given the scene admin-areas
55         And the named places
56             | osm | class    | type           | admin | addr+postcode | geometry |
57             | R1  | boundary | administrative | 6     | 112           | :b0      |
58             | R34 | boundary | administrative | 8     | 112 DE        | :b1:E    |
59         And the named places
60             | osm | class    | type           | admin | geometry |
61             | R4  | boundary | administrative | 10    | :b2:N    |
62         And the named places
63             | osm | class    | type           | geometry |
64             | W93 | highway  | residential    | :w2N     |
65         When importing
66         Then placex contains
67             | object | postcode | parent_place_id |
68             | W93    | 112 DE   | R4 |
69
70     Scenario: Postcodes from the lowest admin area are inherited by buildings
71         Given the scene admin-areas
72         And the named places
73             | osm | class    | type           | admin | addr+postcode | geometry |
74             | R1  | boundary | administrative | 6     | 112           | :b0      |
75             | R34 | boundary | administrative | 8     | 112 DE        | :b1:E    |
76             | R4  | boundary | administrative | 10    | 112 DE 34     | :b2:N    |
77         And the named places
78             | osm | class    | type  | geometry |
79             | W22 | building | yes   | :building:w2N |
80         When importing
81         Then placex contains
82             | object | postcode  |
83             | W22    | 112 DE 34 |
84
85     Scenario: Roads get postcodes from nearby buildings without other info
86         Given the scene admin-areas
87         And the named places
88             | osm | class    | type           | geometry |
89             | W93 | highway  | residential    | :w2N     |
90         And the named places
91             | osm | class    | type        | addr+postcode | geometry |
92             | W22 | building | yes         | 445023        | :building:w2N |
93         When importing
94         Then placex contains
95             | object | postcode |
96             | W93    | 445023   |
97
98     @wip
99     Scenario: Postcodes from admin boundaries are preferred over estimated postcodes
100         Given the scene admin-areas
101         And the named places
102             | osm | class    | type           | admin | addr+postcode | geometry |
103             | R1  | boundary | administrative | 6     | 112           | :b0      |
104             | R34 | boundary | administrative | 8     | 112 DE        | :b1:E    |
105             | R4  | boundary | administrative | 10    | 112 DE 34     | :b2:N    |
106         And the named places
107             | osm | class    | type           | geometry |
108             | W93 | highway  | residential    | :w2N     |
109         And the named places
110             | osm | class    | type        | addr+postcode | geometry |
111             | W22 | building | yes         | 445023        | :building:w2N |
112         When importing
113         Then placex contains
114             | object | postcode  |
115             | W93    | 112 DE 34 |