X,Y coordinates of nodes

Is there a way to get the x,y coordinates for the nodes in a route, specifically the start and end nodes?

You mean the longitude and latitude? Yes, of course they are available. Are you looking at a server response or using the Java API?

I am using the source code, version 8

Is it the way points? like ‘path.getWaypoints’ ?

Are the way points the node locations for 1st and last node on the start and end edge respectively?

Path p;
p.calcPoints().get(0);

would give you the lat/lon/elevation (if enabled) values for the first point.

Or if you are using the GraphHopper class, similarly:

GHResponse r;
r.getBest().getPoints()

Is it the way points? like ‘path.getWaypoints’ ?

The way points are just the one you put in with the request (the start/target points plus the via-points).

Are the way points the node locations for 1st and last node on the start and end edge respectively?

Yes the first way point is the start location and the last the target location.

1 Like