Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

This question already has an answer here:

How can I generate turn-by-turn directions using PgRouting?

At the moment, I have a web-page where a user can enter and start/end location and a route is generated on a map (using PgRouting and OpenStreeMap). I know how to list all of the street names, but I don't know what the best approach for stating which direction the user should take at intersections.

I have read through previous questions on this site: Does pgRouting support turn-by-turn routing? and driving directions in pgRouting but both of these questions are over two years old, and several of the answers link to sites that no longer exist.

share|improve this question
add comment

marked as duplicate by underdark Mar 31 at 13:47

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2 Answers

I'm not a programmer so I borrowed the following from stack overflow after a google search : ) "If you want the direction between to geopoints you have to calculate it. First you need to get the difference of the north/south direction and the the difference of the eas/west direction. Then you can calculate the angle between the two geopoints by using the atan2.

double north_south = point1.getLatitude() - point2.getLatitude(); double east_west = point1.getLongitude() - point2.getLongitude(); int angle = (int) (Math.atan2(east_west, north_south) / Math.PI * 180.0 + 360.0f);This is how you get the direction between 2 points (in degrees). If you want to navigate the user, you have to write a whole navigation software, which is far more complicated. share|improve this answer answered Nov 7 '11 at 15:58 Franziskus Karsunke"

share|improve this answer
add comment

You already link to two other questions, which are more or less the same, so you will hardly get a different answer.

In short: you may want to group your route by street names, then calculate the angle and direction between streets, and depending on their values return text instructions or images.

share|improve this answer
    
Both of these questions are two years old - I was hoping that there might have been some progress since then. I've updated the question to clarify how old these previous questions are. –  djq Jan 25 '13 at 18:33
    
r\Routing follows edges, angles, streetnames, road feature classes, intersections. A logical instruction could be follow streetname to intersections point "a" and make a sharp angle left to street name x and/or y or to destintaion set "x,y" or gradual left, continue straight thru decision point intersection x,y - continuing on classification a,b,c, and taking exit right ramp name, lane, etc. Just an example of instruction sets that could be generated scripturaly and then output as text strings, instructions sets, voice, etc. etc. –  lewis Jan 31 '13 at 15:21
    
@lewis I'm not sure on how best to calculate the angle at intersections - do you have any advice on how to do this? –  djq Jan 31 '13 at 16:56
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.