developer (#13) - pgRouting (#351) - Message List

pgRouting

Hello, i have been working with pgrouting and i store all info of one map now i want to calculate the short path, so i do it with the vexter numbers, but i want calculate it given the lon,lat from point and the lon,lat to point.

please, could any one help me how to do it.

i have the routing but whit vextex id.

  • Message #1459

    Not sure I understood well what your problem is, but if your start/end point is a point in lat/lon, then you need to first select the nearest vertex to your lat/lon position. This is just a PostGIS query and you can take this as some example: http://pgrouting.postlbs.org/wiki/Workshop-ClosestEdge

    • Message #1505

      Hi every one im trying to find the closed edge for my road network, my code is working but is not fine. part of my code to find it is:

      $offset = 0.0001;

      $sql = "SELECT source,

      distance(the_geom, GeometryFromText??(

      'POINT(".$lon." ".$lat.")', 4326)) AS dist

      FROM highway

      WHERE the_geom && setsrid(

      'BOX3D(".($lon-$offset)." ".($lat+$offset).",".($lon+$offset)." ".($lat-$offset).")'::box3d, 4326)

      ORDER BY dist";

      my example return and edge fine, but is bad. i put this imagen to see what happend, the code return me the edge 149, the blue pin is where i need to get the edge in this case must be 150.

      http://204.232.135.228/ar/cedge.png

      help!! please.

      • Message #1507

        Any help?

    • Message #1463

      Daniel, that´s exactly i need. thanks for your help.