I found a workaround for the below problem that is OK for me now (for testing and programming purposes), and write it down in case it will be useful for someone else. Anyone having a good idea for the original problem is still welcome.
I did further experiments with osmosis. This time I used a quite small portion (~1MB in OSM format) of the world map which I downloaded and exported using JOSM, and that also failed to import, with the same exception. After that I realized, that the previous import has already uploaded some nodes/ways, so I had to empty the database and start again. In the end, the only thing that worked for me to drop all databases from pgsql, run 'rake db:migrate' again, and then import the file again. This time osmosis ran without error. If anyone has a simpler way to clean up databases, or to import files with duplicate nodes (even if that means tossing out some nodes), I am very eager to hear it. Thanks, PP Ps.: I created a nasty way to check for duplicate node ids in OSM files: bzgrep 'node id='file.osm.bz2 | cut -d '"' -f2 |sort |uniq -d Of course, this presumes that the XML is laid out "nicely", but this is the case for OSM files on the server. The funny thing is that I found no duplicates in the hungary.osm.bz2 at all... Pallinger Péter írta: > Tom Hughes írta: >> Use PostgreSQL not MySQL - the MySQL support is not really maintained >> anymore so it likely to be extremely fragile as you've just discovered. > Thanks for the tip, I successfully ran "rake db:migrate". However, I failed > to upload > some maps. > > I've tried to run: > -------- > osmosis --read-xml file="hungary.osm.bz2" --write-apidb-0.6 host="localhost" > database="openstreetmap" user="openstreetmap" password="openstreetmap" > validateSchemaVersion=no > -------- > however, it failed with an exception. > The root cause seems to be: > -------- > org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique > constraint > "nodes_pkey" > -------- > > I've seen a thread on this list about a similar error here: > http://www.mail-archive.com/dev@openstreetmap.org/msg08498.html, but there > was no real > solution except to try to fix the OSM file itself (which I would very much > like to not > to do). > > By the way, 'osmosis --read-xml file="hungary.osm.bz2" --write-xml"' succeeds. > > Thank you in advance for any tips, > > PP > > > _______________________________________________ > dev mailing list > dev@openstreetmap.org > http://lists.openstreetmap.org/listinfo/dev _______________________________________________ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev