java - How to see GHResponse on map by using GraphHopperWeb -


i trying use graphhopperweb in order see route response on web. not know how use it, don't wrong. using following code (in java) in order find path 1 point other point following:

    ghrequest req = new ghrequest(32.070113, 34.790266, 32.067103, 34.777861).             setweighting("fastest")             .setvehicle("car");      graphhopperweb gh = new graphhopperweb();     gh.load("http://localhost:8989/route");       gh.setinstructions(true);     ghresponse response = gh.route(req);      system.out.println(response); 

i following print screen:

nodes:24: (32.07012,34.79021), (32.07011,34.7902), (32.07006,34.79019), (32.07028,34.78867), (32.07029,34.78852), (32.07029,34.78847), (32.06994,34.78814), (32.06942,34.78761), (32.06931,34.7875), (32.06912,34.78731), (32.06862,34.78667), (32.06756,34.78546), (32.06627,34.78391), (32.06617,34.78375), (32.06604,34.7836), (32.06622,34.78317), (32.06768,34.78009), (32.06769,34.77998), (32.06767,34.77992), (32.06654,34.77915), (32.06624,34.77894), (32.0666,34.77764), (32.06709,34.7778), (32.06708,34.77785), [(0,continue onto הנציב,6.186,742), (2,turn right onto שדרות יהודית,164.23,19706), (-2,turn left onto מנחם בגין, 2,142.253,9310), (0,continue onto מנחם בגין,517.411,31039), (2,turn right onto לינקולן,394.313,28388), (-1,turn slight left onto יהודה הלוי,183.917,13240), (2,turn right onto בלפור,128.87,9278), (2,turn right onto שדרות רוטשילד,56.539,4070), (2,turn right onto המגיד,4.589,550), (4,finish!,0.0,0)]

but when open explorer address "http://localhost:8989/route" getting following error:

{"info":{"copyrights":["graphhopper","openstreetmap contributors"],"errors":[{"details":"java.lang.illegalstateexception","message":"at least 2 points has specified, was:0"}]}}

i don't how can see ghresponse (the routing path have found) on map thru explorer?

the usage of external graphhopperweb client similar usage of embedded routing described here , points visualization can fetched via getpoints or turn instructions via getinstructions:

ghrequest req = new ghrequest(32.070113, 34.790266, 32.067103, 34.777861)    .setweighting("fastest")    .setvehicle("car");  ghresponse res = gh.route(req);  if(res.haserrors()) {    // handle or throw exceptions res.geterrors()    return; }  // path geometry information (latitude, longitude , optionally elevation) pointlist pl = res.getpoints(); // distance of full path, in meter double distance = res.getdistance(); // time of full path, in milliseconds long millis = res.gettime(); // information per turn instruction instructionlist il = res.getinstructions(); 

Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -