1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
local polygons = osm2pgsql.define_table{
name = 'osm2pgsql_test_polygon',
ids = { type = 'area', id_column = 'osm_id' },
columns = {
{ column = 'name', type = 'text' },
{ column = 'geom', type = 'geometry', projection = test.geom_proj },
{ column = 'area', type = 'area', projection = test.area_proj },
}
}
function is_empty(some_table)
return next(some_table) == nil
end
function osm2pgsql.process_way(object)
if is_empty(object.tags) then
return
end
polygons:add_row({
name = object.tags.name,
geom = { create = 'area' }
})
end
function osm2pgsql.process_relation(object)
polygons:add_row({
name = object.tags.name,
geom = { create = 'area', split_at = 'multi' }
})
end
|