[OSM-dev] OSMOSIS: Problems Importing Data

Karl Newman siliconfiend at gmail.com
Thu Jun 11 16:48:59 BST 2009


On Thu, Jun 11, 2009 at 7:17 AM, Lucier, Trent <trent.lucier at lmco.com>wrote:

>  Greetings,
>
>
>
> 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.
>
>
>
> 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.
>
>
>
>
>
> ///////////// OSMOSIS COMMAND /////////////////
>
>
>
> ./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
>
>
>
> ////////////////////////// MyOSMFile.osm  ///////////////////
>
>
>
> <?xml version='1.0' encoding='UTF-8'?>
>
> <osm version='0.6' generator='JOSM'>
>
>   <node id='-1' visible='true' lat='6.435754189944134'
> lon='-127.70949720670392' />
>
>   <node id='-2' visible='true' lat='-16.089385474860336'
> lon='-78.23463687150839' />
>
>   <node id='-3' visible='true' lat='31.374301675977655'
> lon='-31.977653631284916' />
>
>   <node id='-4' visible='true' lat='28.960893854748605'
> lon='31.1731843575419' />
>
>   <node id='-5' visible='true' lat='36.201117318435756'
> lon='-129.72067039106145' />
>
>   <node id='-6' visible='true' lat='70.39106145251397'
> lon='-110.81564245810057' />
>
>   <node id='-7' visible='true' lat='71.19553072625699'
> lon='-40.022346368715084' />
>
>   <node id='-8' visible='true' lat='44.64804469273743'
> lon='-38.81564245810056' />
>
>   <node id='-9' visible='true' lat='12.067039106145252'
> lon='-77.02793296089386' />
>
>   <node id='-10' visible='true' lat='-42.63687150837989'
> lon='-108.40223463687151' />
>
>   <node id='-11' visible='true' lat='-31.374301675977655'
> lon='-51.28491620111732' />
>
>   <node id='-12' visible='true' lat='13.273743016759777'
> lon='0.2011173184357542' />
>
>   <node id='-13' visible='true' lat='15.687150837988828'
> lon='101.96648044692738' />
>
>   <node id='-14' visible='true' lat='-79.24022346368716'
> lon='28.75977653631285' />
>
>   <node id='-15' visible='true' lat='-65.16201117318437'
> lon='-28.357541899441344' />
>
>   <node id='-16' visible='true' lat='-67.1731843575419'
> lon='-119.66480446927375' />
>
>   <way id='-17' action='modify' visible='true'>
>
>     <nd ref='-1' />
>
>     <nd ref='-2' />
>
>     <nd ref='-3' />
>
>     <nd ref='-4' />
>
>     <tag k='highway' v='primary' />
>
>     <tag k='name' v='Trent Rd.' />
>
>     <tag k='lanes' v='5' />
>
>   </way>
>
>   <way id='-18' action='modify' visible='true'>
>
>     <nd ref='-5' />
>
>     <nd ref='-6' />
>
>     <nd ref='-7' />
>
>     <nd ref='-8' />
>
>     <nd ref='-9' />
>
>     <nd ref='-5' />
>
>     <tag k='name' v='Lake Ontario' />
>
>     <tag k='natural' v='water' />
>
>   </way>
>
>   <way id='-19' action='modify' visible='true'>
>
>     <nd ref='-10' />
>
>     <nd ref='-11' />
>
>     <nd ref='-12' />
>
>     <nd ref='-13' />
>
>     <nd ref='-14' />
>
>     <nd ref='-15' />
>
>     <nd ref='-16' />
>
>     <nd ref='-10' />
>
>     <tag k='wood' v='coniferous' />
>
>     <tag k='name' v='Sherwood Forest' />
>
>     <tag k='landuse' v='forest' />
>
>   </way>
>
> </osm>
>
>
>
>
>
>
>
> ////////////////// ERROR MESSAGE //////////////////
>
>
>
> [root at november osmosis]# ./runOsmosisScript
>
> Jun 11, 2009 9:37:21 AM org.openstreetmap.osmosis.core.Osmosis run
>
> INFO: Osmosis Version 0.31.1
>
> Jun 11, 2009 9:37:21 AM org.openstreetmap.osmosis.core.Osmosis run
>
> INFO: Preparing pipeline.
>
> Jun 11, 2009 9:37:21 AM org.openstreetmap.osmosis.core.Osmosis run
>
> INFO: Launching pipeline execution.
>
> Jun 11, 2009 9:37:21 AM org.openstreetmap.osmosis.core.Osmosis run
>
> INFO: Pipeline executing, waiting for completion.
>
> Jun 11, 2009 9:37:21 AM
> org.openstreetmap.osmosis.core.pipeline.common.ActiveTaskManager
> waitForCompletion
>
> SEVERE: Thread for task 1-read-xml failed
>
> java.lang.NumberFormatException: null
>
>         at java.lang.Integer.parseInt(Integer.java:415)
>
>         at java.lang.Integer.parseInt(Integer.java:497)
>
>         at
> org.openstreetmap.osmosis.core.xml.v0_6.impl.NodeElementProcessor.begin(NodeElementProcessor.java:69)
>
>         at
> org.openstreetmap.osmosis.core.xml.v0_6.impl.OsmHandler.startElement(OsmHandler.java:91)
>
>         at
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)
>
>         at
> com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:179)
>
>         at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1339)
>
>         at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2747)
>
>         at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
>
>         at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
>
>         at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
>
>         at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
>
>         at
> com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
>
>         at
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
>
>         at
> com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
>
>         at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
>
>         at javax.xml.parsers.SAXParser.parse(SAXParser.java:198)
>
>         at
> org.openstreetmap.osmosis.core.xml.v0_6.XmlReader.run(XmlReader.java:108)
>
>         at java.lang.Thread.run(Thread.java:619)
>
> Jun 11, 2009 9:37:21 AM org.openstreetmap.osmosis.core.Osmosis main
>
> SEVERE: Execution aborted.
>
> org.openstreetmap.osmosis.core.OsmosisRuntimeException: One or more tasks
> failed.
>
>         at
> org.openstreetmap.osmosis.core.pipeline.common.Pipeline.waitForCompletion(Pipeline.java:146)
>
>         at org.openstreetmap.osmosis.core.Osmosis.run(Osmosis.java:85)
>
>         at org.openstreetmap.osmosis.core.Osmosis.main(Osmosis.java:30)
>
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.

Karl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20090611/a2e5465f/attachment.html>


More information about the dev mailing list