Hello and thank you for everyone helping me with this!

I am trying to import the file europe-latest.osm.pbf that I downloaded from Geofabrik.
Using either a memory optimized or cpu optimized virtual machines at DigitalOcean, I always get the error below:

2023-10-19 12:07:15.352 [main] INFO  c.g.reader.dem.SRTMProvider - srtm Elevation Provider, from:, to: /opt/routing/srtmprovider, as: MMAP_STORE using inter>
java.lang.RuntimeException: Could not parse OSM file: /opt/routing/europe-latest.osm.pbf
        at com.graphhopper.reader.osm.WaySegmentParser.readOSM(
        at com.graphhopper.reader.osm.WaySegmentParser.readOSM(
        at com.graphhopper.reader.osm.OSMReader.readGraph(
        at com.graphhopper.GraphHopper.importOSM(
        at com.graphhopper.GraphHopper.process(
        at com.graphhopper.GraphHopper.importAndClose(
        at com.graphhopper.application.GraphHopperApplication.main(
Caused by: java.lang.NullPointerException
        at com.graphhopper.reader.osm.OSMNodeData.setTags(
        at com.graphhopper.reader.osm.WaySegmentParser$Pass2Handler.handleNode(
        at com.graphhopper.reader.osm.WaySegmentParser$ReaderElementHandler.handleElement(
        at com.graphhopper.reader.osm.WaySegmentParser.readOSM(
        ... 11 more

I want to include elevation data in my routing responses therefore in my config.yml I made the following settings:

graph.elevation.provider: srtm

  # default location for cache is /tmp/srtm
  graph.elevation.cache_dir: ./srtmprovider/

  # If you have a slow disk or plenty of RAM change the default MMAP to:
  graph.elevation.dataaccess: MMAP

  # To enable bilinear interpolation when sampling elevation at points (default uses nearest neighbor):
  graph.elevation.interpolate: bilinear

  # Reduce ascend/descend per edge without changing the maximum slope:
  graph.elevation.edge_smoothing: ramer
  # removes elevation fluctuations up to max_elevation (in meter) and replaces the elevation with a value based on the average slope
  graph.elevation.edge_smoothing.ramer.max_elevation: 5
  # A potentially bigger reduction of ascend/descend is possible, but maximum slope will often increase (do not use when average_slope or maximum_slope shall be used in a custom_model)
  graph.elevation.edge_smoothing: moving_average

I have also set the default dataaccess type to MMAP:

graph.dataaccess.default_type: MMAP

The graphopper jar I am using is a slightly customized build in which I made one way streets to be routable from both directions. I don’t think this has to do anything with my failures importing the europe dataset but I am including this for the sake of completeness.

The command I am using is :

java -Xmx14g -XX:+UseParallelGC -jar graphhopper-web-8.0-SNAPSHOT.jar import config.yml

Can you tell me what I am doing wrong and at the same time can you point me to the right direction?

I am a full-stack Javascript developer, but in Java I am a total newb, so your patience with me is highly appreciated!

Thank you!

Did you try without enabling elevation yet?

Good point! Not yet. Let me try to do that and get back to you!

There was a bug related to this, but fixed in 8.0. Can you try the latest master?

Was the bug specifically with the import in 8.0-SNAPSHOT? I am only asking because 8.0-SNAPSHOT runs fine on another machine of the client but on a much smaller graph.

I can now confirm that 8.0 SNAPSHOT import fails with nullpointer exception even WITHOUT elevation. I am going to try with the latest master right now.

It must be a verion after this commit: OSMNodeData.nodeKVStorage: add missing create · graphhopper/graphhopper@88fcf94 · GitHub

Thank you! The import has finished OK, including the elevation, I am testing it now. If the test is OK, I will need to be able to kind of de-activate one way streets and make them routable from both directions. I already did that before, but frankly, I forgot how I did it.

Have a look into this: bike profile should allow reverse oneway roads and set walking speed by karussell · Pull Request #2774 · graphhopper/graphhopper · GitHub

Thank you! As this is only going to be used for map matching, I don’t think I will need a custom model. The last time I do remember that I edited the Java code directly and compiled the customized application.
I’ll probably have to go back and check this forum for the post that helped me.

There is no need to edit the Java code. Also for map matching you can create a profile with a (server-side) custom model.

Ok thanks, I will check out how to create a profile! Can a custom model also support including highway=track grade 3 and 4 in the calculation as well? The application I am working on does (and should) not care much about the vehicle traveling on the matched road.

Can a custom model also support including highway=track grade 3 and 4 in the calculation as well?

Grade 3 is allowed by default. Grade 4 is not, at least for the car vehicle. You either need to allow grade4 in trackTypeValues in CarAccessParser and trackTypeSpeedMap in CarAverageSpeedParser, or start from the roads vehicle where all roads are open unless you close them explicitly.

start from the roads vehicle where all roads are open unless you close them explicitly

Can you elaborate on where I can find more information about the road vehicle and how I can set it up?
I have read through the documentation, the custom model chapter in particular, but I did not find any information there about the road vehicle. Also when we are talking about server side models, do you mean the ones I can set up in config.yml? And my last question is, using what kind of rules can I let a one way street to be routable from both ends? In the documentation I only found options for modifying the speed, the priority and the distance influence. None of them seemed to be the option that I was looking for unfortunately.

For anyone reading through this post: I managed to import the europe-latest dataset after pre-processing it using osmconvert and osmfilter. Pre-processing solved my pain of resetting one way streets, thus I didn’t have to fiddle with putting together a custom server side model for Graphhopper.

Calling 2 or 3 extra statements “fiddle” is a bit rough IMO. Especially as you can try them out in GraphHopper Maps with autocomplete and use this model then for the server side. If this is too tricky please let us know where exactly you had problems, so that we can improve it.

Furthermore fine-grained differences per highway (road_class) or for roundabout are possible. Again, have a look into the bike profile where we do this.

Maybe my wording was a bit coarse, my apologies for that! I will do what you have suggested and will let you know how it goes.

Thanks a lot. All feedback is really appreciated!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.