Cameras
OSM2PGSQL
local cameras = osm2pgsql.define_node_table('cameras', {
{ column = 'id', sql_type = 'serial', create_only = true },
{ column = 'geom', type = 'point' },
})
local highways = osm2pgsql.define_way_table('highways', {
{ column = 'id', sql_type = 'serial', create_only = true },
{ column = 'geom', type = 'linestring' },
})
local buildings = osm2pgsql.define_area_table('buildings', {
{ column = 'id', sql_type = 'serial', create_only = true },
{ column = 'geom', type = 'polygon' },
})
function osm2pgsql.process_node(object)
if object.tags.man_made == 'surveillance' then
cameras:insert({
geom = object:as_point( )
})
end
end
function osm2pgsql.process_way(object)
if object.is_closed and object.tags.building then
buildings:insert({
geom = object:as_polygon()
})
end
if object.tags.highway then
highways:insert({
geom = object:as_linestring()
})
end
end
function osm2pgsql.process_relation(object)
if object.tags.type == 'multipolygon' and object.tags.building then
local geom = object:as_multipolygon()
for g in geom:geometries() do
buildings:insert({
geom = g,
})
end
end
end
osm2pgsql -d toto -U toto -W -H localhost -O flex -S extarct_features.lua st_quentin.osm.pbf