]> git.openstreetmap.org Git - nominatim.git/blob - test/bdd/osm2pgsql/import/tags.feature
60d241fe68e9d3296e82ae9c0938882d7b991eab
[nominatim.git] / test / bdd / osm2pgsql / import / tags.feature
1 @DB
2 Feature: Tag evaluation
3     Tests if tags are correctly imported into the place table
4
5     Scenario: Main tags as fallback
6         When loading osm data
7             """
8             n100 Tjunction=yes,highway=bus_stop
9             n101 Tjunction=yes,name=Bar
10             n200 Tbuilding=yes,amenity=cafe
11             n201 Tbuilding=yes,name=Intersting
12             n202 Tbuilding=yes
13             """
14         Then place contains exactly
15             | object | class    | type     |
16             | N100   | highway  | bus_stop |
17             | N101   | junction | yes      |
18             | N200   | amenity  | cafe     |
19             | N201   | building | yes      |
20
21
22     Scenario: Name and reg tags
23         When loading osm data
24             """
25             n2001 Thighway=road,name=Foo,alt_name:de=Bar,ref=45
26             n2002 Thighway=road,name:prefix=Pre,name:suffix=Post,ref:de=55
27             n2003 Thighway=yes,name:%20%de=Foo,name=real1
28             n2004 Thighway=yes,name:%a%de=Foo,name=real2
29             n2005 Thighway=yes,name:%9%de=Foo,name:\\=real3
30             n2006 Thighway=yes,name:%9%de=Foo,name=rea\l3
31             """
32         Then place contains exactly
33             | object | class   | type | name |
34             | N2001  | highway | road | 'name': 'Foo', 'alt_name:de': 'Bar', 'ref': '45' |
35             | N2002  | highway | road | - |
36             | N2003  | highway | yes  | 'name: de': 'Foo', 'name': 'real1' |
37             | N2004  | highway | yes  | 'name:\nde': 'Foo', 'name': 'real2' |
38             | N2005  | highway | yes  | 'name:\tde': 'Foo', 'name:\\\\': 'real3' |
39             | N2006  | highway | yes  | 'name:\tde': 'Foo', 'name': 'rea\\l3' |
40
41         And place contains
42             | object | extratags |
43             | N2002  | 'name:prefix': 'Pre', 'name:suffix': 'Post', 'ref:de': '55' |
44
45
46     Scenario: Name when using with_name flag
47         When loading osm data
48             """
49             n3001 Tbridge=yes,bridge:name=GoldenGate
50             n3002 Tbridge=yes,bridge:name:en=Rainbow
51             """
52         Then place contains exactly
53             | object | class   | type | name                 |
54             | N3001  | bridge  | yes  | 'name': 'GoldenGate' |
55             | N3002  | bridge  | yes  | 'name:en': 'Rainbow' |
56
57
58     Scenario: Address tags
59         When loading osm data
60             """
61             n4001 Taddr:housenumber=34,addr:city=Esmarald,addr:county=Land
62             n4002 Taddr:streetnumber=10,is_in:city=Rootoo,is_in=Gold
63             """
64         Then place contains exactly
65             | object | class | address             |
66             | N4001  | place | 'housenumber': '34', 'city': 'Esmarald', 'county': 'Land' |
67             | N4002  | place | 'streetnumber': '10', 'city': 'Rootoo' |
68
69
70     Scenario: Country codes
71         When loading osm data
72             """
73             n5001 Tshop=yes,country_code=DE
74             n5002 Tshop=yes,country_code=toolong
75             n5003 Tshop=yes,country_code=x
76             n5004 Tshop=yes,addr:country=us
77             n5005 Tshop=yes,country=be
78             n5006 Tshop=yes,addr:country=France
79             """
80         Then place contains exactly
81             | object | class | address         |
82             | N5001  | shop  | 'country': 'DE' |
83             | N5002  | shop  | - |
84             | N5003  | shop  | - |
85             | N5004  | shop  | 'country': 'us' |
86             | N5005  | shop  | - |
87             | N5006  | shop  | - |
88
89
90     Scenario: Postcodes
91         When loading osm data
92             """
93             n6001 Tshop=bank,addr:postcode=12345
94             n6002 Tshop=bank,tiger:zip_left=34343
95             n6003 Tshop=bank,is_in:postcode=9009
96             """
97         Then place contains exactly
98             | object | class | address             |
99             | N6001  | shop  | 'postcode': '12345' |
100             | N6002  | shop  | 'postcode': '34343' |
101             | N6003  | shop  | -                   |
102
103
104     Scenario: Main with extra
105         When loading osm data
106             """
107             n7001 Thighway=primary,bridge=yes,name=1
108             n7002 Thighway=primary,bridge=yes,bridge:name=1
109             """
110         Then place contains exactly
111             | object        | class   | type    | name        | extratags+bridge:name |
112             | N7001         | highway | primary | 'name': '1' | -                     |
113             | N7002:highway | highway | primary | -           | 1                     |
114             | N7002:bridge  | bridge  | yes     | 'name': '1' | 1                     |
115
116
117     Scenario: Global fallback and skipping
118         When loading osm data
119             """
120             n8001 Tshop=shoes,note:de=Nein,xx=yy
121             n8002 Tshop=shoes,building=no,ele=234
122             n8003 Tshop=shoes,name:source=survey
123             """
124         Then place contains exactly
125             | object | class | extratags    |
126             | N8001  | shop  | 'xx': 'yy'   |
127             | N8002  | shop  | 'ele': '234' |
128             | N8003  | shop  | -            |
129
130
131     Scenario: Admin levels
132         When loading osm data
133             """
134             n9001 Tplace=city
135             n9002 Tplace=city,admin_level=16
136             n9003 Tplace=city,admin_level=x
137             n9004 Tplace=city,admin_level=1
138             n9005 Tplace=city,admin_level=0
139             n9006 Tplace=city,admin_level=2.5
140             """
141         Then place contains exactly
142             | object | class | admin_level |
143             | N9001  | place | 15          |
144             | N9002  | place | 15          |
145             | N9003  | place | 15          |
146             | N9004  | place | 1           |
147             | N9005  | place | 15          |
148             | N9006  | place | 15          |
149
150
151     Scenario: Administrative boundaries with place tags
152         When loading osm data
153             """
154             n10001 Tboundary=administrative,place=city,name=A
155             n10002 Tboundary=natural,place=city,name=B
156             n10003 Tboundary=administrative,place=island,name=C
157             """
158         Then place contains
159             | object          | class    | type           | extratags       |
160             | N10001          | boundary | administrative | 'place': 'city' |
161         And place contains
162             | object          | class    | type           |
163             | N10002:boundary | boundary | natural        |
164             | N10002:place    | place    | city           |
165             | N10003:boundary | boundary | administrative |
166             | N10003:place    | place    | island         |
167
168
169     Scenario: Building fallbacks
170         When loading osm data
171             """
172             n12001 Ttourism=hotel,building=yes
173             n12002 Tbuilding=house
174             n12003 Tbuilding=shed,addr:housenumber=1
175             n12004 Tbuilding=yes,name=Das-Haus
176             n12005 Tbuilding=yes,addr:postcode=12345
177             """
178         Then place contains exactly
179             | object | class    | type     |
180             | N12001 | tourism  | hotel    |
181             | N12003 | building | shed     |
182             | N12004 | building | yes      |
183             | N12005 | place    | postcode |
184
185
186     Scenario: Address interpolations
187         When loading osm data
188             """
189             n13001 Taddr:interpolation=odd
190             n13002 Taddr:interpolation=even,place=city
191             """
192         Then place contains exactly
193             | object | class | type   | address                 |
194             | N13001 | place | houses | 'interpolation': 'odd'  |
195             | N13002 | place | houses | 'interpolation': 'even' |