Hi,
I frequently observe that if I run GraphHopper on my local machine it does not find routes between two locations. However, if I query the web demo (https://graphhopper.com/maps/) with the same coordinates it finds a valid route.
Below is a code snippet with two locations in Hamburg, Germany. If I run the code it does not find a route. Same coordinates in the web demo and everything is fine (https://graphhopper.com/maps/?point=53.65587%2010.094348&point=53.58428%2010.15681&locale=de-de&vehicle=car&weighting=fastest&elevation=true&use_miles=false&layer=Omniscale).
I use GraphHopper 0.12.0, OSM dump from 11-03-2019 and I am sure that my OSM file covers both locations. Any idea what I am missing?
Best, Johannes
double latitudeFrom = 53.65587;
double longituteFrom = 10.094348;
double latitudeTo = 53.58428;
double longituteTo = 10.15681;
String osmFile = "myosmfile.osm";
String storageDirectory = "myghdirectory";
GraphHopper hopper = new GraphHopperOSM().forServer();
hopper.setDataReaderFile(osmFile);
hopper.setGraphHopperLocation(storageDirectory);
FlagEncoder encoder = new CarFlagEncoder();
EncodingManager em = EncodingManager.create(encoder);
hopper.setEncodingManager(em);
hopper.importOrLoad();
GHRequest req = new GHRequest(latitudeFrom, longituteFrom, latitudeTo, longituteTo).
setWeighting("fastest").
setVehicle("car").
setLocale(Locale.US);
GHResponse rsp = hopper.route(req);
if(rsp.hasErrors()) {
System.out.println("No route found.");
} else {
System.out.println("Route found.");
}