How to set routing between two countries? Load two "*-gh" folders

I want to get route between two neighborhood countries, I converted pbf files to grapphopper format:

./graphhopper.sh -a import -i germany.osm.pbf
./graphhopper.sh -a import -i moldova.osm.pbf

But when I try to load those countries I get next error:

GraphHopper graphHopper = new GraphHopper().forMobile();
graphHopper.load(new File(mOSMData, "germany-gh").getAbsolutePath());
graphHopper.load(new File(mOSMData, "poland-gh").getAbsolutePath());

Caused by: java.lang.IllegalStateException: graph is already successfully loaded
at com.graphhopper.GraphHopper.load(GraphHopper.java:725)

Is there any solution for that or GraphHopper can work only with one OSM data at the same time and there is no way to connect two countries or two cities if there are different folders?

GraphHopper can only load one storage at a time: https://github.com/graphhopper/graphhopper/issues/293

You can merge both PBFs before the import with e.g. osmconvert.

1 Like

sorry for necropost. are there any updates about loading/merging few GH graphs? or merging OSM files is still the only way here?

short answer: no. yes. :slight_smile:

I mean from what is implemented. It should be possible to run the OSM import sequentially for multiple OSM files that keep adding edges to the same graph. But I never heard of someone doing this.

Powered by Discourse