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 34 35 36 37 38 39 40 41 42 43 44 45
|
local tables = {}
tables.line = osm2pgsql.define_table{
name = 'osm2pgsql_test_line',
ids = { type = 'way', id_column = 'osm_id' },
columns = {
{ column = 'tags', type = 'hstore' },
{ column = 'geom', type = 'linestring', projection = 4326 },
}
}
tables.polygon = osm2pgsql.define_table{
name = 'osm2pgsql_test_polygon',
ids = { type = 'area', id_column = 'osm_id' },
columns = {
{ column = 'tags', type = 'hstore' },
{ column = 'geom', type = 'geometry', projection = 4326 }
}
}
function osm2pgsql.process_way(object)
if not next(object.tags) then
return
end
if object.tags.natural then
tables.polygon:add_row({
tags = object.tags,
geom = { create = 'area' }
})
else
tables.line:add_row({
tags = object.tags
})
end
end
function osm2pgsql.process_relation(object)
tables.polygon:add_row({
tags = object.tags,
geom = { create = 'area', split_at = 'multi' }
})
end
|