pgRouting

Forum #15 - Topic #149 - Message List

Driving instructions

I already got my routes and im able to show on the map. But there is any sample code to generate driving instructions to that route? Like follow Street A for 400mts and turn left to StreetB? I already working on that, but calculating turns is hard, how can i relation 2 geoms to get the angle?

PD. I already post this message but i cant find it :(

  • Message #508

    Juan,

    I think you have to preprocess your result. Driving directions depend a lot on the data you have. Usually you have several small road links that describe the 400m before you have to turn left, but for that you need to know about the road names, maybe you can use numbers or road classes as well. It's all data dependent, so it's difficult to find the "algorithm" that matches well with many networks/countries.

    I agree that it would be nice to have some examples how people process their data. Because here in Japan street names don't exist, I'm still thinking about a clever solution, too. ;-)

    PS: I remember a discussion in the PostGIS mailing list ... could have been this one: http://www.nabble.com/Angle-td5199313.html#a5199313
    Did you ever try the ST_azimuth(geometry, geometry) function to get the angle between two links?