Hello,
when I try to use osm2pgsql, it closes after a second without any import or error message. What may be wrong?
Thanks for any help.
(base) C:\osm2pgsql>C:\osm2pgsql\osm2pgsql.exe -v --log-level debug --log-sql --database=postgres --host=ubuntu.forplan.local --user=fds --password --schema=osm_2024_06_16 --slim --prefix=osmlux --output=flex --style C:\osm2pgsql\flex-config\flex_fds.lua "C:\Users\Kai\Downloads\luxembourg-latest.osm.pbf"
Password:
2024-06-18 14:51:27 [00] osm2pgsql version 1.11.0
2024-06-18 14:51:27 [00] SQL: (C0) SELECT pg_backend_pid()
2024-06-18 14:51:27 [00] SQL: (C0) New database connection (context=check, backend_pid=1731512)
2024-06-18 14:51:27 [00] SQL: (C0) SET synchronous_commit = off
2024-06-18 14:51:27 [00] SQL: (C0) SELECT name, setting FROM pg_catalog.pg_settings
2024-06-18 14:51:27 [00] SQL: (C0) SELECT current_catalog
2024-06-18 14:51:27 [00] SQL: (C0) SELECT regexp_split_to_table(extversion, '\.') FROM pg_catalog.pg_extension WHERE extname='postgis'
2024-06-18 14:51:27 [00] Database version: 14.5 (Ubuntu 14.5-0ubuntu0.22.04.1)
2024-06-18 14:51:27 [00] PostGIS version: 3.2
2024-06-18 14:51:27 [00] SQL: (C0) SELECT extname FROM pg_catalog.pg_extension WHERE true
2024-06-18 14:51:27 [00] SQL: (C0) SELECT nspname FROM pg_catalog.pg_namespace WHERE nspname !~ '^pg_' AND nspname <> 'information_schema'
2024-06-18 14:51:27 [00] SQL: (C0) SELECT spcname FROM pg_catalog.pg_tablespace WHERE spcname != 'pg_global'
2024-06-18 14:51:27 [00] SQL: (C0) SELECT amname FROM pg_catalog.pg_am WHERE amtype = 'i'
2024-06-18 14:51:27 [00] SQL: (C0) SELECT schemaname || '.' || tablename FROM pg_catalog.pg_tables WHERE schemaname NOT IN ('pg_catalog', 'information_schema')
(base) C:\osm2pgsql>
I tried to adjust a configuration I used two years ago. At that time I had to manually extract the file “epsg” from a proj download - maybe there is a similar problem this time? This is flex_fds.lua: EDIT: same result if I remove the projection from the lua file.
-- einfache Konfiguration für osm2pgsql-Flex-mode
-- 2024-06-17 Kai Borgolte (FORPLAN DR. SCHMIEDEL)
local tables = {}
tables.point = osm2pgsql.define_node_table('osm_point', {
{column = 'tags', type = 'jsonb'},
{column = 'geom', type = 'point', projection = 25832, not_null = true},
}, { schema = 'osm_2024_06_16' })
tables.line = osm2pgsql.define_way_table('osm_line', {
{column = 'tags', type = 'jsonb'},
{column = 'nodes', sql_type = 'bigint[]'},
{column = 'geom', type = 'linestring', projection = 25832, not_null = true},
}, { schema = 'osm_2024_06_16' })
tables.polygon = osm2pgsql.define_area_table('osm_polygon', {
{column = 'tags', type = 'jsonb'},
{column = 'nodes', sql_type = 'bigint[]'},
{column = 'geom', type = 'multipolygon', projection = 25832, not_null = true},
}, { schema = 'osm_2024_06_16' })
-- Helper function to remove some of the tags we usually are not interested in.
-- Returns true if there are no tags left.
function clean_tags(tags)
tags.odbl = nil
tags.created_by = nil
tags.source = nil
tags['source:ref'] = nil
return next(tags) == nil
end
-- Helper function that looks at the tags and decides if this is possibly
-- an area.
function has_area_tags(tags)
if tags.area == 'yes' then
return true
end
if tags.area == 'no' then
return false
end
return tags['abandoned:aeroway']
or tags['abandoned:amenity']
or tags['abandoned:building']
or tags['abandoned:landuse']
or tags['abandoned:power']
or tags.aeroway
or tags.amenity
or tags['area:highway']
or tags.building
or tags['building:part']
or tags.harbour
or tags.historic
or tags.landuse
or tags.leisure
or tags.man_made
or tags.military
or tags.natural
or tags.office
or tags.place
or tags.power
or tags.public_transport
or tags.shop
or tags.sport
or tags.tourism
or tags.water
or tags.waterway
or tags.wetland
end
function osm2pgsql.process_node(object)
if clean_tags(object.tags) then
return
end
tables.point:insert({
tags = object.tags,
geom = object:as_point()
})
end
function osm2pgsql.process_way(object)
if clean_tags(object.tags) then
return
end
if object.is_closed and has_area_tags(object.tags) then
tables.polygon:insert({
nodes = '{' .. table.concat(object.nodes, ',') .. '}',
tags = object.tags,
geom = object:as_multipolygon()
})
else
tables.line:insert({
nodes = '{' .. table.concat(object.nodes, ',') .. '}',
tags = object.tags,
geom = object:as_linestring()
})
end
end
function osm2pgsql.process_relation(object)
if clean_tags(object.tags) then
return
end
-- Store multipolygons and boundaries as polygons
if object.tags.type == 'multipolygon' or
object.tags.type == 'boundary' then
tables.polygon:insert({
tags = object.tags,
geom = object.as_multipolygon()
})
end
end