NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Hi everybody,

I am trying to extract only african roads data from a planet.osm.bz2 2013 file. I used Osmosis and, with the coordinates found on openstreetmap, entered :

osmosis --read-xml file="planet.osm.bz2" --bounding-box top=37.58 left=-18.11 bottom=-35.46 right=54.14 --write-xml file="africaroads.osm"

Here is what I get :

C:\Users\Users\Documents\osm test>osmosis --read-xml file="planet.osm.bz2" --bou nding-box top=37.58 left=-18.11 bottom=-35.46 right=54.14 --write-xml file="afri caroads.osm" juil. 03, 2018 3:54:47 PM org.openstreetmap.osmosis.core.Osmosis run INFOS: Osmosis Version 0.46 juil. 03, 2018 3:54:47 PM org.openstreetmap.osmosis.core.Osmosis run INFOS: Preparing pipeline. juil. 03, 2018 3:54:47 PM org.openstreetmap.osmosis.core.Osmosis run INFOS: Launching pipeline execution. juil. 03, 2018 3:54:47 PM org.openstreetmap.osmosis.core.Osmosis run INFOS: Pipeline executing, waiting for completion. juil. 03, 2018 3:54:48 PM org.openstreetmap.osmosis.core.pipeline.common.ActiveT askManager waitForCompletion GRAVE: Thread for task 1-read-xml failed org.openstreetmap.osmosis.core.OsmosisRuntimeException: Unable to parse xml file planet.osm.bz2. publicId=(null), systemId=(null), lineNumber=3959, columnNumbe r=127. at org.openstreetmap.osmosis.xml.v0_6.XmlReader.run(XmlReader.java:100) at java.lang.Thread.run(Unknown Source) 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(Unknown Source) at org.openstreetmap.osmosis.xml.v0_6.XmlReader.run(XmlReader.java:90) ... 1 more

juil. 03, 2018 3:54:48 PM org.openstreetmap.osmosis.core.Osmosis main GRAVE: 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(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Laun cher.java:330) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav a:238) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La uncher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java: 356) at org.codehaus.classworlds.Launcher.main(Launcher.java:47)

Do you have any idea how I can fix this ? thanks in advance

asked 03 Jul '18, 15:05

Clementbat's gravatar image

Clementbat
11112
accept rate: 0%

I'd actually start from an extract of Africa from e.g. Geofabrik.

(09 Jul '18, 11:31) SomeoneElse ♦

Hello,

Given that osmosis is failing out of the gate, and that the error message seems to indicate a difficulty parsing the xml, I guess that the error has to do with the --read-xml portion. Try adding the compressionMethod option to the --read-xml statement. So for a .bz2 file it would be --read-xml -compressionMethod=bzip2

See if that helps, and good luck!

permanent link

answered 31 Jul '18, 22:51

egarnica's gravatar image

egarnica
11113
accept rate: 0%

edited 31 Jul '18, 22:55

These days I tend to use osmium-tool instead of osmosis. And I would recommend to use the pbf file instead of the xml one in any case.

A comparable commandline would thus look like this: osmium extract -b -18.11-35.46 54.14 37.58 planet.osm.pbf -o africaroads.pbf -v

permanent link

answered 03 Aug '18, 15:18

giggls's gravatar image

giggls
12613
accept rate: 50%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×362
×252

question asked: 03 Jul '18, 15:05

question was seen: 4,646 times

last updated: 03 Aug '18, 15:18

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum