@@ -47,3 +47,37 @@ Feature: Creating (multi)linestring features from way and relations
4747 | R | 30 | ST_LineString | 1 , 2 , 3 | NULL |
4848 | R | 31 | ST_MultiLineString | 1 , 2 , 3 | 4 , 5 , 6 |
4949
50+ Scenario :
51+ Given the grid
52+ | 1 | 2 | | |
53+ | | | 3 | 4 |
54+ And the OSM data
55+ """
56+ w20 Thighway=motorway Nn1,n2
57+ w21 Thighway=motorway Nn2,n3
58+ w22 Thighway=motorway Nn3,n4
59+ r30 Ttype=route,route=road Mw20@,w21@
60+ r31 Ttype=route,route=road Mw20@,w22@
61+ """
62+ And the lua style
63+ """
64+ local roads = osm2pgsql.define_relation_table('osm2pgsql_test_roads', {
65+ { column = 'geom', type = 'geometry', projection = 4326 },
66+ { column = 'merged', type = 'geometry', projection = 4326 }
67+ })
68+
69+ function osm2pgsql.process_relation(object)
70+ local g = object:as_multilinestring()
71+ roads:insert({
72+ geom = g,
73+ merged = g:line_merge()
74+ })
75+ end
76+ """
77+ When running osm2pgsql flex
78+
79+ Then table osm2pgsql_test_roads contains exactly
80+ | relation_id | ST_GeometryType (geom ) | ST_GeometryType (merged ) | ST_AsText (ST_GeometryN (merged , 1 )) | ST_AsText (ST_GeometryN (merged , 2 )) |
81+ | 30 | ST_MultiLineString | ST_MultiLineString | 1 , 2 , 3 | NULL |
82+ | 31 | ST_MultiLineString | ST_MultiLineString | 1 , 2 | 3 , 4 |
83+
0 commit comments