GraphHopper.com | Forum | GitHub | Maps | Blog

"Point 0 is out of bounds" Exception with custom osm file


#1

Hi,

i’m having some issues perform routing with a custom and simple graph defined with JOSM.

Here’s the code for routing part:

GraphHopper hopper = new GraphHopperOSM()
            .setOSMFile(f.getAbsolutePath())
            .setGraphHopperLocation(ghDir.getAbsolutePath())
            .setCHEnabled(true)
            .setEnableInstructions(false)
            .setEncodingManager(new EncodingManager("bike"))
            .forServer();

 hopper.importOrLoad();

 double[] pointA = new double[]{27.39085347684,-19.41636378195};
 double[] pointF = new double[]{-0.34328022112,15.87322430068};

 GHRequest req = new GHRequest(pointA[0], pointA[1], pointF[0], 
 pointF[1]).setAlgorithm(Parameters.Algorithms.DIJKSTRA_BI);
 req.getHints().put(Parameters.Routing.INSTRUCTIONS, "true");
 GHResponse resp = hopper.route(req);

 PathWrapper wrapper = resp.getBest();

and i receive the exception

  Point 0 is ouf of bounds: 27.39085347684,-19.41636378195

Heres’ the BBox values:

minLon = -19.41636359877207
maxLon = 15.87322430068
minLat = -0.34328022112
maxLat = 36.13078721876

what is wrong ?

the .osm file can be located here: https://www.dropbox.com/s/x78f655rf0c2yfp/square.osm?dl=0


#2

The

-19.41636378195

might be a little bit too small. Try -19.4163635


#3

Hi,

thanks for your answer.

Actually the values you are talking about @karussell are calculated by graphhopper algorithm (not embedded in osm file).

What i did was, in JOSM, turning on the satellite imagery and what i saw was it was a graph that covered half planet. So i size it down and gave to it a more reasoned dimensions and inputted boundin box (calculated by hands) a bounding box and now seems to give me a path (not the sortest, to be honest).

The strange things is i have to remove the graphhopper wokring directory everytime to make it work. Any idea for this ?

Thanks,
A


#4

reading other response i found that i have to call clean()