#TSTam
Osm2pgsql not get lua config file
I have osmosis (based on pgsnapshot schema) database and add into data for Crimean region, got from Geofabrik. Now, I decided append the Belarus region by osm2pgsql and create this lua file: print("Loading geobase.lua") local tables {} -- NODES tables.nodes = osm2pgsql.define_node_table({ name = 'nodes', ids = { type = 'node', id_column = 'id' }, columns = { { column = 'gid', type = 'bigint' }, { column = 'version', type = 'int' }, { column = 'user_id', type = 'int' }, { column = 'tstamp', type = 'timestamp' }, { column = 'changeset_id', type = 'bigint' }, { column = 'tags', type = 'hstore' }, { column = 'geom', type = 'point', projection = 4326 }, } }) -- WAYS tables.ways = osm2pgsql.define_way_table('ways', { { column = 'id', type = 'bigint' }, { column = 'version', type = 'int' }, { column = 'user_id', type = 'int' }, { column = 'tstamp', type = 'timestamp' }, { column = 'changeset_id', type = 'bigint' }, { column = 'tags', type = 'hstore' }, { column = 'nodes', type = 'bigint[]' }, -- nodes_hash, linestring, highway, building: можно вычислять отдельно, если нужно }) -- WAY_NODES tables.way_nodes = osm2pgsql.define_way_node_table('way_nodes', { { column = 'way_id', type = 'bigint' }, { column = 'node_id', type = 'bigint' }, { column = 'sequence_id', type = 'int' } }) -- RELATIONS tables.relations = osm2pgsql.define_relation_table('relations', { { column = 'id', type = 'bigint' }, { column = 'version', type = 'int' }, { column = 'user_id', type = 'int' }, { column = 'tstamp', type = 'timestamp' }, { column = 'changeset_id', type = 'bigint' }, { column = 'tags', type = 'hstore' }, -- imported_id, members_hash: можно вычислять отдельно, если нужно }) -- RELATION_MEMBERS tables.relation_members = osm2pgsql.define_relation_member_table('relation_members', { { column = 'relation_id', type = 'bigint' }, { column = 'member_id', type = 'bigint' }, { column = 'member_type', type = 'char' }, { column = 'member_role', type = 'text' }, { column = 'sequence_id', type = 'int' } }) function osm2pgsql.process_node(object) tables.nodes:add_row({ id = object.id, version = object.version, user_id = object.uid, tstamp = object.timestamp, changeset_id = object.changeset, tags = osm2pgsql.to_hstore(object.tags), geom = { create = 'point', coords = { object.lon, object.lat } } }) end function osm2pgsql.process_way(object) tables.ways:add_row({ id = object.id, version = object.version, user_id = object.uid, tstamp = object.timestamp, changeset_id = object.changeset, tags = osm2pgsql.to_hstore(object.tags), nodes = object.nodes }) -- way_nodes for i, node_id in ipairs(object.nodes) do tables.way_nodes:add_row({ way_id = object.id, node_id = node_id, sequence_id = i }) end end function osm2pgsql.process_relation(object) tables.relations:add_row({ id = object.id, version = object.version, user_id = object.uid, tstamp = object.timestamp, changeset_id = object.changeset, tags = osm2pgsql.to_hstore(object.tags) }) -- relation_members for i, member in ipairs(object.members) do tables.relation_members:add_row({ relation_id = object.id, member_id = member.ref, member_type = string.upper(string.sub(member.type, 1, 1)), -- N/W/R member_role = member.role or '', sequence_id = i }) end end print("End of geobase.lua") but, when run osm2pgsl: osm2pgsql -H 127.0.0.1 -d geobase -U postgres -W --slim -O flex -S ./geobase.lua --append --flat-nodes /tmp/flat_nodes_cache.bin ./belarus-latest.osm.pbf I see this error: ERROR: Database error: ERROR: relation "planet_osm_ways" not exists LINE 1: ...REPARE mark_ways_by_node(int8) AS SELECT id FROM "planet_os... And not any print to console from lua file too. What I do wrong?
gis.stackexchange.com
May 30, 2025 at 1:22 PM