Hi there,

I am using osmar to work with open streetmap data in R. I tried to import a small area (25km²) from the german os.pbf (2.7 GB). Yet this failed due to osmosis not parsing the osm file.

System: Ubuntu 15.04, i686 GNU/Linux, 4 Cores, 8GB Ram

R: platform i686-pc-linux-gnu
arch i686
os linux-gnu
system i686, linux-gnu
status
major 3
minor 1.2
year 2014
month 10
day 31
svn rev 66913
language R
version.string R version 3.1.2 (2014-10-31) nickname Pumpkin Helmet

R-Script:

require (osmar)

setwd ("~/data/")

### Datasource
src <- osmsource_osmosis("/home/administrator/data/pgsql/osm_germany/germany-latest.osm.pbf")

### BBox
bb_sol_leipz <- center_bbox(12.359383, 51.403859,  width = 5000, height = 5000)

sol_leipz <- get_osm(bb_sol_leipz, source = src)

Error Report:

Mrz 18, 2016 12:19:23 PM org.openstreetmap.osmosis.core.Osmosis run
INFORMATION: Osmosis Version 0.43.1
Mrz 18, 2016 12:19:23 PM org.openstreetmap.osmosis.core.Osmosis run
INFORMATION: Preparing pipeline.
Mrz 18, 2016 12:19:23 PM org.openstreetmap.osmosis.core.Osmosis run
INFORMATION: Launching pipeline execution.
Mrz 18, 2016 12:19:23 PM org.openstreetmap.osmosis.core.Osmosis run
INFORMATION: Pipeline executing, waiting for completion.
Mrz 18, 2016 12:19:23 PM org.openstreetmap.osmosis.core.pipeline.common.ActiveTaskManager waitForCompletion
SCHWERWIEGEND: Thread for task 1-read-xml failed
org.openstreetmap.osmosis.core.OsmosisRuntimeException: Unable to parse xml file /home/administrator/data/pgsql/osm_germany/germany-latest.osm.pbf.  publicId=(null), systemId=(null), lineNumber=1, columnNumber=1.
    at org.openstreetmap.osmosis.xml.v0_6.XmlReader.run(XmlReader.java:116)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
    at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown 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.XMLDocumentScannerImpl$PrologDispatcher.dispatch(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown 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 Source)
    at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
    at javax.xml.parsers.SAXParser.parse(SAXParser.java:189)
    at org.openstreetmap.osmosis.xml.v0_6.XmlReader.run(XmlReader.java:111)
    ... 1 more

Mrz 18, 2016 12:19:23 PM org.openstreetmap.osmosis.core.Osmosis main
SCHWERWIEGEND: 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: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(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:328)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:408)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:351)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:31)

Fehler in file(con, "r") : kann Verbindung nicht öffnen
Zusätzlich: Warnmeldung:
In file(con, "r") :
  kann Datei '/tmp/RtmpLD8AMb/file5f1170f48b12' nicht öffnen: Datei oder Verzeichnis nicht gefunden

Thanks for your help,

Gunnar

asked 18 Mar '16, 12:26

GunnarOeh's gravatar image

GunnarOeh
11113
accept rate: 0%

Just checking, but does the MD5sum of the germany-latest file match?

(18 Mar '16, 12:29) SomeoneElse ♦
1

Hi, thanks for the hint:

md5sum -c data/pgsql/osm_germany/germany-latest.osm.pbf

md5sum: data/pgsql/osm_germany/germany-latest.osm.pbf: keine korrekt formatierte MD5‐Prüfsummenzeile gefunden

(no correct md5sum found)

(18 Mar '16, 12:34) GunnarOeh
1

Try without the -c, and manually compare the resulting checksum with the .osm.pbf.md5 file on the download site.

(18 Mar '16, 13:22) Frederik Ramm ♦

The error message

org.openstreetmap.osmosis.core.OsmosisRuntimeException: Unable to parse xml file

tells us that it is trying to parse the file as an XML file but it is a PBF file. Download the .osm.bz2 file and try with that, or fix Osmar to use the --read-pbf flag to Osmosis instead of --read-xml.

permanent link

answered 18 Mar '16, 13:27

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
70.9k836431106
accept rate: 24%

"Unable to parse xml file" means that osmosis can open OK but can't make sense of it, which usually means a partial download (as confirmed in the comment above).

permanent link
This answer is marked "community wiki".

answered 18 Mar '16, 13:01

SomeoneElse's gravatar image

SomeoneElse ♦
32.2k63333752
accept rate: 15%

wikified 18 Mar '16, 13:01

Your answer
toggle preview

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:

×219
×8
×2

question asked: 18 Mar '16, 12:26

question was seen: 4,049 times

last updated: 18 Mar '16, 13:27

powered by OSQA