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: https://srtm.kurviger.de/SRTM3/, 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(WaySegmentParser.java:415)
at com.graphhopper.reader.osm.WaySegmentParser.readOSM(WaySegmentParser.java:116)
at com.graphhopper.reader.osm.OSMReader.readGraph(OSMReader.java:174)
at com.graphhopper.GraphHopper.importOSM(GraphHopper.java:933)
at com.graphhopper.GraphHopper.process(GraphHopper.java:863)
at com.graphhopper.GraphHopper.importAndClose(GraphHopper.java:826)
at com.graphhopper.application.cli.ImportCommand.run(ImportCommand.java:36)
at com.graphhopper.application.cli.ImportCommand.run(ImportCommand.java:27)
at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:98)
at io.dropwizard.cli.Cli.run(Cli.java:78)
at io.dropwizard.Application.run(Application.java:94)
at com.graphhopper.application.GraphHopperApplication.main(GraphHopperApplication.java:38)
Caused by: java.lang.NullPointerException
at com.graphhopper.storage.MMapDataAccess.newByteBuffer(MMapDataAccess.java:240)
at com.graphhopper.storage.MMapDataAccess.mapIt(MMapDataAccess.java:218)
at com.graphhopper.storage.MMapDataAccess.ensureCapacity(MMapDataAccess.java:182)
at com.graphhopper.search.KVStorage.add(KVStorage.java:225)
at com.graphhopper.reader.osm.OSMNodeData.setTags(OSMNodeData.java:252)
at com.graphhopper.reader.osm.WaySegmentParser$Pass2Handler.handleNode(WaySegmentParser.java:241)
at com.graphhopper.reader.osm.WaySegmentParser$ReaderElementHandler.handleElement(WaySegmentParser.java:531)
at com.graphhopper.reader.osm.WaySegmentParser.readOSM(WaySegmentParser.java:410)
... 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!