]> git.openstreetmap.org Git - nominatim.git/blob - test/bdd/osm2pgsql/import/tags.feature
8c3d5c139a1ac90d60ff26bd4b9d83fc4a2e4965
[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             """
79         Then place contains exactly
80             | object | class | address         |
81             | N5001  | shop  | 'country': 'DE' |
82             | N5002  | shop  | - |
83             | N5003  | shop  | - |
84             | N5004  | shop  | 'country': 'us' |
85             | N5005  | shop  | - |
86
87
88     Scenario: Postcodes
89         When loading osm data
90             """
91             n6001 Tshop=bank,addr:postcode=12345
92             n6002 Tshop=bank,tiger:zip_left=34343
93             n6003 Tshop=bank,is_in:postcode=9009
94             """
95         Then place contains exactly
96             | object | class | address             |
97             | N6001  | shop  | 'postcode': '12345' |
98             | N6002  | shop  | 'postcode': '34343' |
99             | N6003  | shop  | -                   |
100
101
102     Scenario: Main with extra
103         When loading osm data
104             """
105             n7001 Thighway=primary,bridge=yes,name=1
106             n7002 Thighway=primary,bridge=yes,bridge:name=1
107             """
108         Then place contains exactly
109             | object        | class   | type    | name        | extratags         |
110             | N7001         | highway | primary | 'name': '1' | -                 |
111             | N7002:highway | highway | primary | -           | 'bridge:name': '1'|
112             | N7002:bridge  | bridge  | yes     | 'name': '1' | 'bridge:name': '1'|
113
114
115     Scenario: Global fallback and skipping
116         When loading osm data
117             """
118             n8001 Tshop=shoes,note:de=Nein,xx=yy
119             n8002 Tshop=shoes,building=no,ele=234
120             n8003 Tshop=shoes,name:source=survey
121             """
122         Then place contains exactly
123             | object | class | extratags    |
124             | N8001  | shop  | 'xx': 'yy'   |
125             | N8002  | shop  | 'ele': '234' |
126             | N8003  | shop  | -            |
127
128
129     Scenario: Admin levels
130         When loading osm data
131             """
132             n9001 Tplace=city
133             n9002 Tplace=city,admin_level=16
134             n9003 Tplace=city,admin_level=x
135             n9004 Tplace=city,admin_level=1
136             n9005 Tplace=city,admin_level=0
137             n9006 Tplace=city,admin_level=2.5
138             """
139         Then place contains exactly
140             | object | class | admin_level |
141             | N9001  | place | 15          |
142             | N9002  | place | 15          |
143             | N9003  | place | 15          |
144             | N9004  | place | 1           |
145             | N9005  | place | 15          |
146             | N9006  | place | 15          |
147
148
149     Scenario: Administrative boundaries with place tags
150         When loading osm data
151             """
152             n10001 Tboundary=administrative,place=city,name=A
153             n10002 Tboundary=natural,place=city,name=B
154             n10003 Tboundary=administrative,place=island,name=C
155             """
156         Then place contains exactly
157             | object          | class    | type           | extratags       |
158             | N10001          | boundary | administrative | 'place': 'city' |
159             | N10002:boundary | boundary | natural        | - |
160             | N10002:place    | place    | city           | - |
161             | N10003:boundary | boundary | administrative | - |
162             | N10003:place    | place    | island         | - |
163
164
165     Scenario: Shorten tiger:county tags
166         When loading osm data
167             """
168             n11001 Tplace=village,tiger:county=Feebourgh%2c%%20%AL
169             n11002 Tplace=village,addr:state=Alabama,tiger:county=Feebourgh%2c%%20%AL
170             n11003 Tplace=village,tiger:county=Feebourgh
171             """
172         Then place contains exactly
173             | object | class | address             |
174             | N11001 | place | 'tiger:county': 'Feebourgh county' |
175             | N11002 | place | 'tiger:county': 'Feebourgh county', 'state': 'Alabama' |
176             | N11003 | place | 'tiger:county': 'Feebourgh county' |
177
178
179     Scenario: Building fallbacks
180         When loading osm data
181             """
182             n12001 Ttourism=hotel,building=yes
183             n12002 Tbuilding=house
184             n12003 Tbuilding=shed,addr:housenumber=1
185             n12004 Tbuilding=yes,name=Das-Haus
186             n12005 Tbuilding=yes,addr:postcode=12345
187             """
188         Then place contains exactly
189             | object | class    | type     |
190             | N12001 | tourism  | hotel    |
191             | N12003 | building | shed     |
192             | N12004 | building | yes      |
193             | N12005 | place    | postcode |
194
195
196     Scenario: Address interpolations
197         When loading osm data
198             """
199             n13001 Taddr:interpolation=odd
200             n13002 Taddr:interpolation=even,place=city
201             """
202         Then place contains exactly
203             | object | class | type   | extratags       | address                 |
204             | N13001 | place | houses | -               | 'interpolation': 'odd'  |
205             | N13002 | place | houses | 'place': 'city' | 'interpolation': 'even' |