2

I create a graphHopper instance using:

 GraphHopper hopper = new GraphHopper().forServer();
 hopper.setCHEnable(false);
 hopper.setGraphHopperLocation("hopper");
 hopper.setOSMFile("greater-london-latest.osm");
 hopper.setEncodingManager(new EncodingManager("car"));
 hopper.setMinNetworkSize(200, 100);
 hopper.importOrLoad();

I send a request using:

 GHRequest req = new GHRequest().addPoint(new GHPoint(latFrom, lonFrom)).addPoint(new GHPoint(latTo, lonTo))
            .setVehicle("car")
            .setLocale(Locale.ENGLISH)
            .setWeighting("fastest")
            .setAlgorithm(AlgorithmOptions.ASTAR_BI);

 req.getHints().put("pass_through", true);
 GHResponse res = hopper.route(req);

But I get the following error:

 [java.lang.RuntimeException: Connection between locations not found]

These are some examples of lat/long pairs I'm using:

 Lat1 51.519265 Long1 -0.021345 Lat2 51.502635 Long2 -0.022702
 Lat1 51.49109 Long1 -0.018716 Lat2 51.502661 Long2 -0.021596
 Lat1 51.503143 Long1 -0.008428 Lat2 51.502661 Long2 -0.021596

I have double checked (all) of these lat/long pairs with https://graphhopper.com/maps/?point=51.499041%2C-0.020157&point=51.503083%2C-0.017676&locale=de&vehicle=car&weighting=fastest&elevation=true&layer=Lyrk and they are working.

I then searched for a solution and found Graphhopper returns "not found" which looks like an identical question so I added the following to my code:

hopper.setMinNetworkSize(200, 100);

This setting allowed graph-hopper to find a few more connections but unfortunately there are some long/lat pairs that still dont work (examples are above). What can I do to stop the RuntimeException: Connection between locations not found?

Edit:

Switching the long/lat pairs seems to be better:

GHRequest req2 = new GHRequest().addPoint(new GHPoint(latTo, lonTo)).addPoint(new GHPoint(latFrom, lonFrom))

But this provides opposite directions. How can I correct this? Does this problem occur because these are one-way streets?

Community
  • 1
  • 1
MTA
  • 739
  • 2
  • 9
  • 29

1 Answers1

0

I had the same problem as you. My solution was:

hopper.setMinNetworkSize(200, 200);

When the parameter minOnewayNetworkSize is set to 200, the router does not get stuck in an (oneway) island.

See: Graphhopper returns "not found"

regispires
  • 73
  • 1
  • 5