NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

When i use the latest osmosis to import china-latest.psm.pbf into openstreetmap database, some error eccurs, it says that unable to insert user with id 3642735 into the database, duplicate key value violates unique constraint "users_display_name_idx", Key (display_name)=(Nodes&Roads) already exists. I drop the openstreetmap database and re-create it before run the osmosis command, so the database is empty, but the error still appears. I also try to import other data file such as jordan-latest.osm.pbf, it runs successfully without any error. Only the china-latest.psm.pbf file can not import correctly. It confuses me serveral days and i still could not find out the solution, anyone can help me or give me some useful tips please,thank you.

The command line is osmosis --read-pbf planet/china-lastet.osm.pbf --write-apidb host="localhost" database="openstreetmap" user="osm" password="osm" validateSchemaVersion="no".

And here is the error log:

Thread for task 1-read-pbf failed org.openstreetmap.osmosis.core.OsmosisRuntimeException: Unable to insert user with id 3642735 into the database. at org.openstreetmap.osmosis.apidb.v0_6.impl.UserManager.insertUser( at org.openstreetmap.osmosis.apidb.v0_6.impl.UserManager.addOrUpdateUser( at org.openstreetmap.osmosis.apidb.v0_6.ApidbWriter.process( at crosby.binary.osmosis.OsmosisBinaryParser.parseDense( at org.openstreetmap.osmosis.osmbinary.BinaryParser.parse( at org.openstreetmap.osmosis.osmbinary.BinaryParser.handleBlock( at org.openstreetmap.osmosis.osmbinary.file.FileBlock.process( at org.openstreetmap.osmosis.osmbinary.file.BlockInputStream.process( at at Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "users_display_name_idx" 详细:Key (display_name)=(Nodes&Roads) already exists. at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse( at org.postgresql.core.v3.QueryExecutorImpl.processResults( at org.postgresql.core.v3.QueryExecutorImpl.execute( at org.postgresql.jdbc2.AbstractJdbc2Statement.execute( at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags( at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate( at org.openstreetmap.osmosis.apidb.v0_6.impl.UserManager.insertUser( ... 9 more

九月 28, 2016 10:04:30 上午 org.openstreetmap.osmosis.core.Osmosis main 严重: Execution aborted. org.openstreetmap.osmosis.core.OsmosisRuntimeException: One or more tasks failed. at org.openstreetmap.osmosis.core.pipeline.common.Pipeline.waitForCompletion( at at org.openstreetmap.osmosis.core.Osmosis.main( at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke( at sun.reflect.DelegatingMethodAccessorImpl.invoke( at java.lang.reflect.Method.invoke( at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard( at org.codehaus.plexus.classworlds.launcher.Launcher.launch( at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode( at org.codehaus.plexus.classworlds.launcher.Launcher.main( at org.codehaus.classworlds.Launcher.main(

asked 27 Sep '16, 15:36

yuyy's gravatar image

accept rate: 20%

edited 28 Sep '16, 03:05

I assume you are using a download from geofabrik.

The error doesn't ring a bell. Can you give us the complete command line you are using an the complete error log (right now I would suspect a character encoding or similar error).

(27 Sep '16, 23:54) SimonPoole ♦

Please never add what should be a comment as an answer and then edit it. That makes it impossible to rearrange questions and comments as they should be.

Back to the question: this looks like an issue somewhere in the API code or the data dumper or on the extract side as this "should not happen".

We've checked and it seems to be a specific issue with the extract you are using. See answer below.

(28 Sep '16, 09:48) SimonPoole ♦

Thanks to your reply, i will be more careful next time.

(28 Sep '16, 09:58) yuyy

The extracts from Geofabrik are kept up to date by applying diffs, as a consequence when a contributor changes their display name this is not propagated to all the data contributed in the extract.

Or put differently: you cannot use Geofabrik extracts to populate an API database with osmosis except if you are very lucky, which you are not.

I would suggest checking with mapzen or another provider of extracts if they generate them differently.

permanent link

answered 28 Sep '16, 10:06

SimonPoole's gravatar image

SimonPoole ♦
accept rate: 18%

edited 28 Sep '16, 10:08

I transformed the china-latest.osm.pbf into .osc file, and i find that there are two different user_id use the same display_name, one is :

<node id="221454099" version="4" timestamp="2016-02-19T01:31:31Z" uid="1708958" user="Nodes&amp;Roads" changeset="37300193" lat="28.5580746" lon="98.4585189"/>

Another is :

<node id="224205729" version="3" timestamp="2016-02-20T00:02:20Z" uid="3642735" user="Nodes&amp;Roads" changeset="37320893" lat="28.0394804" lon="99.5276968"/>

Maybe we can change one of the display_name in the .osc file to solve the problem. But if i want use the .pbf file, what should i do? I don't know how to edit the .pbf file, i also asked another question here. If someone have some ideal, please answer here.

permanent link

answered 28 Sep '16, 08:58

yuyy's gravatar image

accept rate: 20%

edited 28 Sep '16, 08:59

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 27 Sep '16, 15:36

question was seen: 4,022 times

last updated: 28 Sep '16, 10:12

NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum