]> git.openstreetmap.org Git - nominatim.git/blob - test/bdd/features/osm2pgsql/import/entrances.feature
Merge pull request #3861 from lonvia/force-extra-tags
[nominatim.git] / test / bdd / features / osm2pgsql / import / entrances.feature
1 Feature: Import of entrance objects by osm2pgsql
2     Testing of correct setup of the entrance table
3
4     Scenario: Import simple entrance
5         When loading osm data
6           """
7           n1 Tshop=sweets,entrance=yes,access=public x4.5 y-4
8           n2 Trouting:entrance=main x66.1 y0.1
9           n3 Tentrance=main,routing:entrance=foot x1 y2
10           n4 Thighway=bus_stop
11           """
12         Then place contains exactly
13           | object | class   | type   |
14           | N1     | shop    | sweets |
15           | N4     | highway | bus_stop |
16         And place_entrance contains exactly
17           | osm_id | type | extratags!dict                       | geometry!wkt |
18           | 1      | yes  | 'shop': 'sweets', 'access': 'public' | 4.5 -4       |
19           | 2      | main | -                                    | 66.1 0.1     |
20           | 3      | main | -                                    | 1 2          |
21
22     Scenario: Addresses and entrance information can exist on the same node
23         When loading osm data
24           """
25           n1 Taddr:housenumber=10,addr:street=North,entrance=main
26           """
27           Then place contains exactly
28             | object | class | type  | address+housenumber |
29             | N1     | place | house | 10                  |
30           And place_entrance contains exactly
31             | osm_id | type |
32             | 1      | main |
33     Scenario Outline: Entrance import can be disabled
34         Given the lua style file
35             """
36             local flex = require('import-full')
37             flex.set_entrance_filter<param>
38             """
39         When loading osm data
40           """
41           n1 Tentrance=yes,access=public
42           n2 Trouting:entrance=main
43           """
44         Then place contains exactly
45           | object |
46         And place_entrance contains exactly
47           | osm_id |
48
49         Examples:
50           | param |
51           | ()    |
52           | (nil) |
53           | {}    |
54           | {include={'access'}} |
55           | {main_tags={}}       |
56
57     Scenario: Entrance import can have custom main tags
58         Given the lua style file
59             """
60             local flex = require('import-full')
61             flex.set_entrance_filter{main_tags = {'door'}}
62             """
63         When loading osm data
64           """
65           n1 Tentrance=yes,access=public
66           n2 Tdoor=foot,entrance=yes
67           """
68         Then place contains exactly
69           | object |
70         And place_entrance contains exactly
71           | osm_id | type | extratags!dict    |
72           | 2      | foot | 'entrance': 'yes' |
73
74     Scenario: Entrance import can have custom extra tags included
75         Given the lua style file
76             """
77             local flex = require('import-full')
78             flex.set_entrance_filter{main_tags = {'entrance'},
79                                      extra_include = {'access'}}
80             """
81         When loading osm data
82           """
83           n1 Tentrance=yes,access=public,shop=newspaper
84           n2 Tentrance=yes,shop=sweets
85           """
86         Then place_entrance contains exactly
87           | osm_id | type | extratags!dict     |
88           | 1      | yes  | 'access': 'public' |
89           | 2      | yes  | -                  |
90
91     Scenario: Entrance import can have custom extra tags excluded
92         Given the lua style file
93             """
94             local flex = require('import-full')
95             flex.set_entrance_filter{main_tags = {'entrance', 'door'},
96                                      extra_exclude = {'shop'}}
97             """
98         When loading osm data
99           """
100           n1 Tentrance=yes,access=public,shop=newspaper
101           n2 Tentrance=yes,door=yes,shop=sweets
102           """
103         Then place_entrance contains exactly
104           | osm_id | type | extratags!dict     |
105           | 1      | yes  | 'access': 'public' |
106           | 2      | yes  | -                  |
107
108     Scenario: Entrance import can have a custom function
109         Given the lua style file
110             """
111             local flex = require('import-full')
112             flex.set_entrance_filter(function(object)
113                 return {entrance='always', extratags = {ref = '1'}}
114             end)
115             """
116         When loading osm data
117           """
118           n1 Tentrance=yes,access=public,shop=newspaper
119           n2 Tshop=sweets
120           """
121         Then place_entrance contains exactly
122           | osm_id | type   | extratags!dict     |
123           | 1      | always | 'ref': '1'         |
124           | 2      | always | 'ref': '1'         |