<div class="gmail_quote">On Thu, Jun 11, 2009 at 7:17 AM, Lucier, Trent <span dir="ltr"><<a href="mailto:trent.lucier@lmco.com">trent.lucier@lmco.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div link="blue" vlink="purple" lang="EN-US">
<div>
<p>Greetings,</p>
<p> </p>
<p>I am having trouble loading data into a PostgreSQL database
using Osmosis. I’ve gone through various steps that I’ve
found online, but I inevitably get an error message. My current approach
is to create a simple OSM file using JOSM, and try to import that. However,
I am getting a NumberFormatException. I have pasted my command, the OSM
file, and the error message below. My OS is CentOS. Any help
appreciated.</p>
<p> </p>
<p>Also, I am just using PostgreSQL 8.3.7. I don’t
need to install PostGIS, right? When I ran the “rake test”
script, I did get some errors and failures, but I assumed that was because my
OSM installation is not in an internet enabled environment. </p>
<p> </p>
<p> </p>
<p>///////////// OSMOSIS COMMAND /////////////////</p>
<p> </p>
<p>./osmosis-0.31.1/bin/osmosis --read-xml file="MyOSMFile.osm"
--write-apidb dbType=postgresql host="localhost"
database="openstreetmap" user="openstreetmap"
password="password" validateSchemaVersion=no </p>
<p> </p>
<p>////////////////////////// MyOSMFile.osm ///////////////////</p>
<p> </p>
<p><?xml version='1.0' encoding='UTF-8'?></p>
<p><osm version='0.6' generator='JOSM'></p>
<p> <node id='-1' visible='true'
lat='6.435754189944134' lon='-127.70949720670392' /></p>
<p> <node id='-2' visible='true'
lat='-16.089385474860336' lon='-78.23463687150839' /></p>
<p> <node id='-3' visible='true' lat='31.374301675977655'
lon='-31.977653631284916' /></p>
<p> <node id='-4' visible='true'
lat='28.960893854748605' lon='31.1731843575419' /></p>
<p> <node id='-5' visible='true'
lat='36.201117318435756' lon='-129.72067039106145' /></p>
<p> <node id='-6' visible='true'
lat='70.39106145251397' lon='-110.81564245810057' /></p>
<p> <node id='-7' visible='true'
lat='71.19553072625699' lon='-40.022346368715084' /></p>
<p> <node id='-8' visible='true'
lat='44.64804469273743' lon='-38.81564245810056' /></p>
<p> <node id='-9' visible='true'
lat='12.067039106145252' lon='-77.02793296089386' /></p>
<p> <node id='-10' visible='true'
lat='-42.63687150837989' lon='-108.40223463687151' /></p>
<p> <node id='-11' visible='true'
lat='-31.374301675977655' lon='-51.28491620111732' /></p>
<p> <node id='-12' visible='true'
lat='13.273743016759777' lon='0.2011173184357542' /></p>
<p> <node id='-13' visible='true'
lat='15.687150837988828' lon='101.96648044692738' /></p>
<p> <node id='-14' visible='true'
lat='-79.24022346368716' lon='28.75977653631285' /></p>
<p> <node id='-15' visible='true'
lat='-65.16201117318437' lon='-28.357541899441344' /></p>
<p> <node id='-16' visible='true'
lat='-67.1731843575419' lon='-119.66480446927375' /></p>
<p> <way id='-17' action='modify' visible='true'></p>
<p> <nd ref='-1' /></p>
<p> <nd ref='-2' /></p>
<p> <nd ref='-3' /></p>
<p> <nd ref='-4' /></p>
<p> <tag k='highway' v='primary' /></p>
<p> <tag k='name' v='Trent Rd.' /></p>
<p> <tag k='lanes' v='5' /></p>
<p> </way></p>
<p> <way id='-18' action='modify' visible='true'></p>
<p> <nd ref='-5' /></p>
<p> <nd ref='-6' /></p>
<p> <nd ref='-7' /></p>
<p> <nd ref='-8' /></p>
<p> <nd ref='-9' /></p>
<p> <nd ref='-5' /></p>
<p> <tag k='name' v='Lake Ontario' /></p>
<p> <tag k='natural' v='water' /></p>
<p> </way></p>
<p> <way id='-19' action='modify' visible='true'></p>
<p> <nd ref='-10' /></p>
<p> <nd ref='-11' /></p>
<p> <nd ref='-12' /></p>
<p> <nd ref='-13' /></p>
<p> <nd ref='-14' /></p>
<p> <nd ref='-15' /></p>
<p> <nd ref='-16' /></p>
<p> <nd ref='-10' /></p>
<p> <tag k='wood' v='coniferous' /></p>
<p> <tag k='name' v='Sherwood Forest'
/></p>
<p> <tag k='landuse' v='forest' /></p>
<p> </way></p>
<p></osm></p>
<p> </p>
<p> </p>
<p> </p>
<p>////////////////// ERROR MESSAGE //////////////////</p>
<p> </p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New";">[root@november osmosis]# ./runOsmosisScript </span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New";">Jun 11, 2009 9:37:21 AM
org.openstreetmap.osmosis.core.Osmosis run</span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New";">INFO: Osmosis Version 0.31.1</span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New";">Jun 11, 2009 9:37:21 AM
org.openstreetmap.osmosis.core.Osmosis run</span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New";">INFO: Preparing pipeline.</span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New";">Jun 11, 2009 9:37:21 AM
org.openstreetmap.osmosis.core.Osmosis run</span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New";">INFO: Launching pipeline execution.</span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New";">Jun 11, 2009 9:37:21 AM org.openstreetmap.osmosis.core.Osmosis
run</span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New";">INFO: Pipeline executing, waiting for completion.</span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New";">Jun 11, 2009 9:37:21 AM
org.openstreetmap.osmosis.core.pipeline.common.ActiveTaskManager
waitForCompletion</span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New";">SEVERE: Thread for task 1-read-xml failed</span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New";">java.lang.NumberFormatException: null</span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New";"> at
java.lang.Integer.parseInt(Integer.java:415)</span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New";"> at
java.lang.Integer.parseInt(Integer.java:497)</span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New";"> at
org.openstreetmap.osmosis.core.xml.v0_6.impl.NodeElementProcessor.begin(NodeElementProcessor.java:69)</span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New";"> at
org.openstreetmap.osmosis.core.xml.v0_6.impl.OsmHandler.startElement(OsmHandler.java:91)</span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New";"> at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)</span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New";"> at
com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:179)</span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New";"> at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1339)</span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New";"> at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2747)</span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New";"> at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)</span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New";"> at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)</span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New";"> at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)</span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New";"> at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)</span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New";"> at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)</span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New";"> at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)</span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New";"> at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)</span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New";"> at
javax.xml.parsers.SAXParser.parse(SAXParser.java:395)</span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New";"> at
javax.xml.parsers.SAXParser.parse(SAXParser.java:198)</span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New";"> at
org.openstreetmap.osmosis.core.xml.v0_6.XmlReader.run(XmlReader.java:108)</span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New";"> at
java.lang.Thread.run(Thread.java:619)</span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New";">Jun 11, 2009 9:37:21 AM
org.openstreetmap.osmosis.core.Osmosis main</span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New";">SEVERE: Execution aborted.</span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New";">org.openstreetmap.osmosis.core.OsmosisRuntimeException:
One or more tasks failed.</span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New";"> at
org.openstreetmap.osmosis.core.pipeline.common.Pipeline.waitForCompletion(Pipeline.java:146)</span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New";"> at
org.openstreetmap.osmosis.core.Osmosis.run(Osmosis.java:85)</span></p>
<p><span style="font-size: 10pt; font-family: "Courier New";">
at org.openstreetmap.osmosis.core.Osmosis.main(Osmosis.java:30)</span></p></div></div></blockquote></div>The error is in Osmosis reading the XML, not at all related to your database. The problem is that Osmosis is expecting more attributes in the element, namely: version, user, uid, timestamp and changeset. The file you've created with JOSM doesn't have those, obviously.<br>
<br>Karl<br>