I meant that example yes.
We just use it without the “.forServer()” (look into the method is just sets some things for you, isn’t needed locally or at all. You don’t build a server. You can just create a Class with a constructor that’s doing:
GraphHopper hopper = new GraphHopperOSM().forServer();
// where to store graphhopper files?
// now this can take minutes if it imports or a few seconds for loading
// of course this is dependent on the area you import
and a function distance which has 2 paramaeters for your call and returns for example:
This function includes:
GHRequest req = new GHRequest(latFrom, lonFrom, latTo, lonTo).
GHResponse rsp = hopper.route(req);
// first check for errors
// handle them!
Just write a main for processing your csv and loop over all entrys and you will be fine. The graphfolder which is created just takes some time. (multiple hours if you need a big region, but it’s just a one time operation, loading an existing graph folder just takes seconds or minutes. It depends on your region size also)
The pbf file (called osmfile in the example) can you get from for example: https://download.geofabrik.de/ What regions do you need? Just a single country or more?
It all runs locally in your java environment. With a graphfolder in your memory something like 100ms per request.
@karussell What’s the .forServer() method good for? Is it better to use it everytime you run it on a server? Or is it just to set something like memstore? I didn’t notice any downside not using it, so I’m just interested.