GraphHopper.com | Forum | GitHub | Maps | Blog

Exception in thread "PBF Reader" java.lang.RuntimeException: Unable to read PBF file


#1

I am trying to load a merged osm file. I have set min network size and one way network size to 0. Getting the below error log when trying to import osm pbf file and build the graph

Exception in thread “PBF Reader” java.lang.RuntimeException: Unable to read PBF file.
at com.graphhopper.reader.osm.pbf.PbfReader.run(PbfReader.java:50)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: A PBF decoding worker thread failed, aborting.
at com.graphhopper.reader.osm.pbf.PbfDecoder.sendResultsToSink(PbfDecoder.java:87)
at com.graphhopper.reader.osm.pbf.PbfDecoder.processBlobs(PbfDecoder.java:151)
at com.graphhopper.reader.osm.pbf.PbfDecoder.run(PbfDecoder.java:162)
at com.graphhopper.reader.osm.pbf.PbfReader.run(PbfReader.java:47)
… 1 more
Caused by: java.lang.ClassCastException: cannot be cast to java.lang.Long
at com.graphhopper.reader.osm.pbf.PbfBlobDecoder.processNodes(PbfBlobDecoder.java:189)
at com.graphhopper.reader.osm.pbf.PbfBlobDecoder.processOsmPrimitives(PbfBlobDecoder.java:329)
at com.graphhopper.reader.osm.pbf.PbfBlobDecoder.runAndTrapExceptions(PbfBlobDecoder.java:343)
at com.graphhopper.reader.osm.pbf.PbfBlobDecoder.run(PbfBlobDecoder.java:355)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
… 1 more


#2

Probably your pbf is not correct then, as it seems to work with all official pbf from Geofabrik oder OSM.


#3

Have a look if all node IDs are existent


#4

Im facing the problem only when using merged and converted files and not on the official downloaded files. Not sure how to go about this issue…


#5

How do you merge them?


#6

osmconvert /home/osm/spain-latest.osm.pbf -o=/home/osm/spain-latest.o5m

osmconvert /home/osm/germany-latest.osm.pbf -o=/home/osm/germany-latest.o5m

osmconvert /home/osm/spain-latest.o5m /home/osm/germany-latest.o5m -o=spain-germany-latest.o5m

osmconvert /home/osm/spain-germany-latest.o5m -o=/home/osm/spain-germany-latest.osm.pbf


#7

And do other tools work when you give them this pbf?

Also there is osmium that can print the text form of a pbf - would you mind to give like two nodes and two ways for this? http://osmcode.org/osmium-tool/manual.html

Also osmium can merge - would you mind to try this:

osmium merge country1.osm.pbf country2.osm.pbf -o together.osm.pbf


#8

osm2pgsql did work with the same pbf while I was trying out pgRouting


#9

@karussell Since I had set min network size and one way network size to 0 while building the graph, the routing has roads included which are dead ends. Is there any way I can filter out dead ends during route calculation? EdgeFilter perhaps is the one I could possible look into, but how do I detect dead ends?


#10

Did you got it working now? The min network setting has only partly to do with dead ends. The settings makes sure that certain dead ends with oneway streets are removed or small subnetworks (regardless of the oneway property)


#11

Yes. And No. Yes because it did build a graph once on server and No because it did not when I tried it in my local system.

Is there any way I can prevent dead ends from being part of route generated?


#12

There is no inbuilt way to do it. Why would you want this?


#13

Well, maybe I am doing something wrong for it to be part of the route first of all. But I think its better to not let the user navigate to dead end and then force him to make a u turn after leading him in first place which is not a good user experience…


#14

Not sure if I understand this. Do you have an example on GraphHopper Maps?


#15

It seems to work in graphhopper maps correctly, but it doesn’t if I use google maps to plot the route… I think maybe the osm data is incorrect for Asia in specific. There are roads that are not actually there in real or atleast in google maps, but in osm they are present.