Skip to content

Commit e0153e3

Browse files
committed
Modernize bbox.lua example config
* Use insert()
1 parent 672b1b0 commit e0153e3

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

flex-config/bbox.lua

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,10 @@ function osm2pgsql.process_node(object)
9595
return
9696
end
9797

98-
tables.pois:add_row({
98+
tables.pois:insert({
99+
tags = object.tags,
99100
bbox = format_bbox(object),
100-
tags = object.tags
101+
geom = object:as_point()
101102
})
102103
end
103104

@@ -108,16 +109,16 @@ function osm2pgsql.process_way(object)
108109

109110
-- A closed way that also has the right tags for an area is a polygon.
110111
if object.is_closed and has_area_tags(object.tags) then
111-
tables.polygons:add_row({
112+
tables.polygons:insert({
112113
tags = object.tags,
113114
bbox = format_bbox(object),
114-
geom = { create = 'area' }
115+
geom = object:as_polygon()
115116
})
116117
else
117-
tables.ways:add_row({
118+
tables.ways:insert({
118119
tags = object.tags,
119120
bbox = format_bbox(object),
120-
geom = { create = 'line' }
121+
geom = object:as_linestring()
121122
})
122123
end
123124
end
@@ -131,21 +132,21 @@ function osm2pgsql.process_relation(object)
131132

132133
-- Store boundary relations as multilinestrings
133134
if relation_type == 'boundary' then
134-
tables.boundaries:add_row({
135+
tables.boundaries:insert({
135136
type = object.tags.boundary,
136137
bbox = format_bbox(object),
137138
tags = object.tags,
138-
geom = { create = 'line' }
139+
geom = object:as_multilinestring()
139140
})
140141
return
141142
end
142143

143144
-- Store multipolygon relations as polygons
144145
if relation_type == 'multipolygon' then
145-
tables.polygons:add_row({
146+
tables.polygons:insert({
146147
bbox = format_bbox(object),
147148
tags = object.tags,
148-
geom = { create = 'area' }
149+
geom = object:as_multipolygon()
149150
})
150151
end
151152
end

0 commit comments

Comments
 (0)