[OSM-dev] Fwd: First experience

Brett Henderson brett at bretth.com
Mon Aug 24 07:49:08 BST 2009


Dennie.nl wrote:
> Brett, apologies for sending the email direct to you!
>
> Hello Brett,
>
> The ruby problems are solved, I mentioned them for future reference 
> (if somebody searches the archives). Next time I will run it on an 
> virtual appliance, thanks for the tip.
> Answers on your questions:
> > 3. Using version 0.31.2:  <osmosis_home>bin\osmosis --read-xml 
> "path_to\planet-benelux-090817.osm" --write-apidb host="localhost" 
> user="openstreetmap" password="openstreetmap" dbType="mysql"
> > 4. I don't have the compleet stacktrace anymore and I can't use my 
> local pc right now to bulk read the entire database but basicly the 
> mysql jdbc driver throws an exception with the message: Duplicate 
> entry '37847304-2-court' for key 'PRIMARY'  and this leads to Osmosis 
> throwing an exception with the message: Unable to bulk insert way tags 
> into the database.
> After restarting the tool it tries to populate the OSM database 
> instead of the openstreetmap database.
Have you run osmosis against a database that isn't empty?  If you've 
imported some data then attempt to import it again you'll get primary 
key violations.  You can clear a database using the --truncate-apidb 
task 
(http://wiki.openstreetmap.org/wiki/Osmosis/DetailedUsage#--truncate-apidb_.28--td.29).

If this doesn't explain the problem you'll need to dig deeper.  It is 
failing trying to write a way tag.  The key being violated is 
'37847304-2-court'.  I haven't checked the database, but it sounds like 
a way tag with way id 378...., version 2, and key "court" already exists 
in the database.  Perhaps the way has two tags with the same name?  The 
error is coming from MySQL itself, not Osmosis so by looking at the 
input XML and the database you should be able to identify the source of 
the problem.  Either the duplicate entry already exists in the database, 
or it is being written twice due to duplicate data in the XML.

I'm confused by your command "after restarting the tool it tries to 
populate the OSM database" though.  Why would it suddenly switch to 
another database instance?  It should only connect to the database you 
specify.

> 2. I am a java programmer and have some understanding of exception 
> concepts. My quess is that the database structure of mysql isn't very 
> well tested against mysql after switching from mysql -> postgress?
That is true.  MySQL doesn't receive much (if any) testing.  Although I 
don't think that's the issue here.  If there is a bug in Osmosis and 
you're familiar with Java I'd greatly appreciate some assistance in 
identifying the source of the problem.

Hope that helps,
Brett





More information about the dev mailing list