This may be obvious, but for whatever reason, I&#39;m not able to figure it out. When calculating driving directions with pgrouting, to find the starting and ending points for the path finding algorithm, I&#39;m using the sample &quot;findNearestEdge&quot; function from pgrouting&#39;s website, which looks like this:<br>
<br>function findNearestEdge($lonlat) {<br><br>   $con = pg_connect(&quot;dbname=&quot;.PG_DB.&quot; host=&quot;.PG_HOST.&quot; user=&quot;.PG_USER);<br><br>   $sql = &quot;SELECT gid, source, target, the_geom,<br>           distance(the_geom, GeometryFromText(<br>
                  &#39;POINT(&quot;.$lonlat[0].&quot; &quot;.$lonlat[1].&quot;)&#39;, 4326)) AS dist<br>            FROM &quot;.TABLE.&quot;<br>            WHERE the_geom &amp;&amp; setsrid(<br>                  &#39;BOX3D(&quot;.($lonlat[0]-0.1).&quot;<br>
                         &quot;.($lonlat[1]-0.1).&quot;,<br>                         &quot;.($lonlat[0]+0.1).&quot;<br>                         &quot;.($lonlat[1]+0.1).&quot;)&#39;::box3d, 4326)<br>            ORDER BY dist LIMIT 1&quot;;<br>
<br>   $query = pg_query($con,$sql);<br><br>   $edge[&#39;gid&#39;]      = pg_fetch_result($query, 0, 0);<br>   $edge[&#39;source&#39;]   = pg_fetch_result($query, 0, 1);<br>   $edge[&#39;target&#39;]   = pg_fetch_result($query, 0, 2);<br>
   $edge[&#39;the_geom&#39;] = pg_fetch_result($query, 0, 3);<br><br>   pg_close($con);<br><br>   return $edge;<br>}<br><br><br>What I&#39;d like to do is adjust the starting and ending points so they match up exactly with my lat/lon beginning/ending points. For example, the way it works now if my destination is mid-way down a particular street and I plot the route on a map, it may look like the route takes you to the end of the block, when it should have stopped earlier, or vice-versa. I hope that makes sense...<br>
<br>My lack of expertise with pgrouting keeps me from understanding some other posts I&#39;ve seen about this topic. Could someone point me in the right direction... thanks a lot.<br>