-
-
Save quintona/e5208c7b68aced6f19e6 to your computer and use it in GitHub Desktop.
Updated Gist after I got the contraction hierarchies working
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TestGH { | |
@Test | |
public void test() { | |
GraphHopper gh = new GraphHopper().forServer().contractionHierarchies(true); | |
gh.load("./london.osm"); | |
GHRequest request = new GHRequest(51.559997,-0.226593, | |
51.448016,0.063171); | |
request.algorithm("dijkstrabi"); | |
StopWatch sw = new StopWatch().start(); | |
GHResponse response = gh.route(request); | |
System.out.println("Route Time: " + sw.stop().getSeconds()); | |
System.out.println(response.distance() + " " + response.time()); | |
PointList points = response.points(); | |
for (int i = 0; i < points.size(); i++) { | |
System.out.println(points.latitude(i) + " : " + points.longitude(i)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment