OSM files loading in Java library

Hey,

Can we load several osm.pbf files? I use java library. I created new GraphHopper() instance. And then I can only use setOsmFile(String file) which contains only one parameter for one file. But I have to load several osm.pbf files. Is it any way to do this? And also when I call importOrLoad() method should I call it next time I run my program with the same osm.pbf?
Problem occured because I wanted to load a big part of a map and faced to OutOfMemory error. I can’t increase heap space to the size of the map

GraphHopper does not have any built-in functionality to support importing multiple OSM files. The easiest way you can still use several OSM files is merging them into one file using tools like Osmosis or Osmium. After you imported the file once you no longer need it, so when you call importOrLoad again you just need to make sure the graph.location points to your graph directory.

1 Like