Skip to content

Commit b49fdd8

Browse files
committed
switch unitable example to insert()
Also switch to geometrycollection for saving relations. This way all non-empty relations are captured.
1 parent 0899d68 commit b49fdd8

File tree

1 file changed

+6
-19
lines changed

1 file changed

+6
-19
lines changed

flex-config/unitable.lua

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -31,42 +31,29 @@ function clean_tags(tags)
3131
return next(tags) == nil
3232
end
3333

34-
function process(object, geometry_type)
34+
function process(object, geometry)
3535
if clean_tags(object.tags) then
3636
return
3737
end
38-
dtable:add_row({
38+
dtable:insert({
3939
attrs = {
4040
version = object.version,
4141
timestamp = object.timestamp,
4242
},
4343
tags = object.tags,
44-
geom = { create = geometry_type }
44+
geom = geometry
4545
})
4646
end
4747

4848
function osm2pgsql.process_node(object)
49-
process(object, 'point')
49+
process(object, object:as_point())
5050
end
5151

5252
function osm2pgsql.process_way(object)
53-
process(object, 'line')
53+
process(object, object:as_linestring())
5454
end
5555

5656
function osm2pgsql.process_relation(object)
57-
if clean_tags(object.tags) then
58-
return
59-
end
60-
61-
if object.tags.type == 'multipolygon' or object.tags.type == 'boundary' then
62-
dtable:add_row({
63-
attrs = {
64-
version = object.version,
65-
timestamp = object.timestamp,
66-
},
67-
tags = object.tags,
68-
geom = { create = 'area' }
69-
})
70-
end
57+
process(object, object:as_geometrycollection())
7158
end
7259

0 commit comments

Comments
 (0)