@@ -77,7 +77,7 @@ Feature: Test get_bbox() function
7777 | 4326 | 20 10 .1 ,20 .1 10 .1 ,20 .1 10 |
7878 | 3857 | 2226389 .8 1130195 .4 ,2237521 .8 1130195 .4 ,2237521 .8 1118890 .0 |
7979
80- Scenario Outline : for relations
80+ Scenario Outline : for relations with way members only
8181 Given the 0.1 grid with origin 20.0 10.1
8282 | 10 | 11 |
8383 | | 12 |
@@ -124,3 +124,37 @@ Feature: Test get_bbox() function
124124 | 4326 | 10 , 11 | 10 , 11 , 12 |
125125 | 3857 | 2226389 .8 1130195 .4 ,2237521 .8 1130195 .4 | 2226389 .8 1130195 .4 ,2237521 .8 1130195 .4 ,2237521 .8 1118890 .0 |
126126
127+ Scenario : for relations with node and way members
128+ Given the 0.1 grid with origin 20.0 10.1
129+ | 10 | 11 | |
130+ | | 12 | 13 |
131+ | 14 | | |
132+ And the OSM data
133+ """
134+ w20 v1 dV Nn10,n11
135+ w21 v1 dV Nn11,n12
136+ r30 v1 dV Ttype=route,route=bus Mw20@,w21@,n13@,n14@
137+ """
138+ And the lua style
139+ """
140+ local rels = osm2pgsql.define_relation_table('osm2pgsql_test_routes', {
141+ { column = 'min_x', type = 'real' },
142+ { column = 'min_y', type = 'real' },
143+ { column = 'max_x', type = 'real' },
144+ { column = 'max_y', type = 'real' },
145+ { column = 'geom', type = 'geometry', projection = 4326, not_null = true },
146+ })
147+
148+ function osm2pgsql.process_relation(object)
149+ local row = {}
150+ row.min_x, row.min_y, row.max_x, row.max_y = object:get_bbox()
151+ row.geom = object:as_geometrycollection()
152+ rels:insert(row)
153+ end
154+ """
155+ When running osm2pgsql flex
156+
157+ Then table osm2pgsql_test_routes contains exactly
158+ | relation_id | min_x | max_x | min_y | max_y |
159+ | 30 | 20 .0 | 20 .2 | 9 .9 | 10 .1 |
160+
0 commit comments