3

I downloaded planet-latest.osm.bz2 file. Then tried to extract data using the following command.

osmosis --read-xml enableDateParsing=no file=J:\planet-latest.osm\planet-latest.osm.bz2 
--bounding-box top=9.882275 bottom=5.965754 left=79.506340 right=82.02209 --write-xml 
file=J:\planet-latest.osm\new.osm

But this command gives errors as in following

Aug 10, 2013 3:43:07 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Osmosis Version 0.43.1
Aug 10, 2013 3:43:07 PM org.java.plugin.registry.xml.ManifestParser <init>
INFO: got SAX parser factory - org.apache.xerces.jaxp.SAXParserFactoryImpl@15e60
1
Aug 10, 2013 3:43:07 PM org.java.plugin.registry.xml.PluginRegistryImpl configur
e
INFO: configured, stopOnError=false, isValidating=true
Aug 10, 2013 3:43:07 PM org.java.plugin.registry.xml.PluginRegistryImpl register

INFO: plug-in and fragment descriptors registered - 1
Aug 10, 2013 3:43:07 PM org.java.plugin.standard.StandardPluginManager activateP
lugin
INFO: plug-in started - [email protected]
39a160-dirty
Aug 10, 2013 3:43:07 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Preparing pipeline.
Aug 10, 2013 3:43:07 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Launching pipeline execution.
Aug 10, 2013 3:43:07 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Pipeline executing, waiting for completion.
Aug 10, 2013 3:43:18 PM org.openstreetmap.osmosis.core.pipeline.common.ActiveTas
kManager waitForCompletion
SEVERE: Thread for task 1-read-xml failed
org.openstreetmap.osmosis.core.OsmosisRuntimeException: Unable to parse xml file
 J:\planet-latest.osm\planet-latest.osm.bz2.  publicId=(null), systemId=(null),
lineNumber=3959, columnNumber=127.
        at org.openstreetmap.osmosis.xml.v0_6.XmlReader.run(XmlReader.java:116)
        at java.lang.Thread.run(Thread.java:722)
Caused by: org.xml.sax.SAXParseException; lineNumber: 3959; columnNumber: 127; X
ML document structures must start and end within the same entity.
        at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Un
known Source)
        at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)

        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
        at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.endEntity(Unkno
wn Source)
        at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(Unknown Sourc
e)
        at org.apache.xerces.impl.XMLEntityManager.endEntity(Unknown Source)
        at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)
        at org.apache.xerces.impl.XMLEntityScanner.skipSpaces(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanAttribute(U
nknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElemen
t(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent
Dispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Un
known Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Sour
ce)
        at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
        at javax.xml.parsers.SAXParser.parse(SAXParser.java:195)
        at org.openstreetmap.osmosis.xml.v0_6.XmlReader.run(XmlReader.java:111)
        ... 1 more

Aug 10, 2013 3:43:18 PM 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.waitForComple
tion(Pipeline.java:146)
        at org.openstreetmap.osmosis.core.Osmosis.run(Osmosis.java:92)
        at org.openstreetmap.osmosis.core.Osmosis.main(Osmosis.java:37)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Laun
cher.java:329)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
a:239)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
uncher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
352)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:47)

How do I solve this problem?

1 Answer 1

1

Part of the error log says:

XML document structures must start and end within the same entity.

This looks like a broken download.

To test your tool chain, you better start up with some of the smaller datasets offered by Geofabrik. By the way, reading .pbf is much faster than the old .bz2 format.

For simple filtering, I would prefer osmfilter and osmconvert.

3
  • seems like I do not have necessary processing power to extract the data from coordinates top 9.882275 left 79.506340 bottom 5.965754 right 82.02209. Is there a way that I can download data for Sri Lanka from the latest planet-osm files. I am asking this because none of the sites that gives osm regional data does not give updated data on Sri Lanka.
    – MWH
    Commented Aug 10, 2013 at 9:35
  • Since I was using osgeo on virtual machine I can not do huge processing over there. Because of that I downloaded the osmosis windows binary and ran the osmosis command again. Now a new error appears. I updated the question with new data.
    – MWH
    Commented Aug 10, 2013 at 10:12
  • 1
    The whole planet is very large, and I am not sure what limitations Windows 7 has. Windows XP can definitely not handle the whole planet. From the error message, it could well be that your download was broken. Sri Lanka should be part of download.geofabrik.de/asia-latest.osm.pbf which is only 2.3GB large. And give osmconvert a chance...
    – AndreJ
    Commented Aug 10, 2013 at 10:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.