shootingstar (#18) - Closet edge (#360) - Message List

Closet edge

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(

'BOX2D(".($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!!

  • Message #1503

    sorry the code is it:

    $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";