Esempio n. 1
0
 public static function getRoutesByRadius($conn, $lon, $lat, $radius)
 {
     $routes = array();
     $result = $conn->query("SELECT *,astext(the_geom) FROM walkroutes " . "WHERE authorised=1");
     while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
         if (haversine_dist($row["startlon"], $row["startlat"], $lon, $lat) < $radius) {
             $wr = new Walkroute($conn);
             $wr->loadFromRow($row);
             $routes[] = $wr;
         }
     }
     return $routes;
 }
Esempio n. 2
0
function realdist($x1, $y1, $x2, $y2)
{
    $ll1 = sphmerc_to_ll($x1, $y1);
    $ll2 = sphmerc_to_ll($x2, $y2);
    return haversine_dist($ll1['lon'], $ll1['lat'], $ll2['lon'], $ll2['lat']);
}