コード例 #1
0
 public static void main(String[] args) {
   GraphHopperAPI gh = new GraphHopperWeb();
   gh.load("http://localhost:8989/route");
   // GHResponse ph = gh.route(new GHRequest(53.080827, 9.074707, 50.597186, 11.184082));
   GHResponse ph = gh.route(new GHRequest(49.6724, 11.3494, 49.6550, 11.4180));
   System.out.println(ph);
 }
コード例 #2
0
 @Test
 public void testGraphHopperWeb() throws Exception {
   GraphHopperAPI hopper = new GraphHopperWeb();
   assertTrue(hopper.load(getTestAPIUrl()));
   GHResponse rsp = hopper.route(new GHRequest(42.554851, 1.536198, 42.510071, 1.548128));
   assertTrue(rsp.getErrors().toString(), rsp.getErrors().isEmpty());
   assertTrue("distance wasn't correct:" + rsp.getDistance(), rsp.getDistance() > 9000);
   assertTrue("distance wasn't correct:" + rsp.getDistance(), rsp.getDistance() < 9500);
 }