I use nohup osmosis --read-pbf /mnt/planet/planet-latest.osm.pbf --write-apidb host="localhost" database="openstreetmap" user="osm" password="osm" validateSchemaVersion="no command to import data into openstreetmap database three days ago, today , the command failed by following error:
十二月 15, 2016 3:31:01 上午 org.openstreetmap.osmosis.core.Osmosis run
信息: Osmosis Version 0.40.1
十二月 15, 2016 3:31:01 上午 org.openstreetmap.osmosis.core.Osmosis run
信息: Preparing pipeline.
十二月 15, 2016 3:31:01 上午 org.openstreetmap.osmosis.core.Osmosis run
信息: Launching pipeline execution.
at crosby.binary.osmosis.OsmosisBinaryParser.parseWays(OsmosisBinaryParser.java:172)
at crosby.binary.BinaryParser.parse(Unknown Source)
at crosby.binary.BinaryParser.handleBlock(Unknown Source)
at crosby.binary.file.FileBlock.process(Unknown Source)
at crosby.binary.file.BlockInputStream.process(Unknown Source)
at crosby.binary.osmosis.OsmosisReader.run(OsmosisReader.java:37)
at java.lang.Thread.run(Thread.java:745)
**Caused by**: org.postgresql.util.PSQLException: ERROR: cannot have more than 2^32-1 commands in a transaction
在位置:SQL statement "SELECT 1 FROM ONLY "public"."ways" x WHERE "way_id" OPERATOR(pg_catalog.=) $1 AND "version" OPERATOR(pg_catalog.=) $2 FOR KEY SHARE OF x"
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2157)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1886)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:555)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:417)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:363)
at org.openstreetmap.osmosis.apidb.v0_6.ApidbWriter.flushWayTags(ApidbWriter.java:723)
... 12 more
It has import 821GB data into the database, and this makes me lose hope to import the planet data successfully, please help me. The osmosis version is 0.40.1, should i use the latest version 0.45 to re-run the command again?
asked
18 Dec '16, 01:59
yuyy
236●22●24●31
accept rate:
20%
org.postgresql.util.PSQLException: ERROR: cannot have more than 2^32-1 commands in a transaction
-> This is a bug in osmosis: https://trac.openstreetmap.org/ticket/4597 .Unfortunately still open, at least according to the ticket. However version 0.40.1 is very very old. I think there is a valid chance that the newest version doesn't produce this error any more.I use the newest version 0.45 to re-run the command, but the error appears again, what should i do, Is there any other solution to import the planet data into the database?
Yes, for example using osm2pgsql. It really depends on your use-case. See https://wiki.openstreetmap.org/wiki/Databases_and_data_access_APIs#Database_Schemas
How to use osm2pgsql to import planet data into the openstreetmap database? What's the command if i just need the updatable schemas? I have installed the rails port, and i need to display the detail message after i use nominatiom to search a place name.