Last active
December 16, 2015 05:39
-
-
Save quintona/5385839 to your computer and use it in GitHub Desktop.
Issue getting started with graphhopper
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
@Test | |
public void test() { | |
Date start = new Date(); | |
//GraphHopper gh = new GraphHopper().forServer(); //<- this works, line below doesn't | |
GraphHopper gh = new GraphHopper().forServer().contractionHierarchies(true); | |
gh.load("./london.osm"); | |
Date end = new Date(); | |
System.out.println("Load Time: " + (end.getTime() - start.getTime())); | |
GHRequest request = new GHRequest(51.430896,0.115356, | |
51.564266,-0.219727); | |
//request.algorithm("dijkstraNative"); | |
start = new Date(); | |
GHResponse response = gh.route(request); | |
end = new Date(); | |
System.out.println("Route Time: " + (end.getTime() - start.getTime())); | |
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