Exemplo n.º 1
0
 if ($_GET['type'] == 'dir') {
     // get locations for end address
     $saddr = $_GET['saddr'];
     // check for boston and ma
     $saddr = checkString($saddr, $city);
     $saddr = checkString($saddr, $state);
     $starts = getLocations($saddr);
     // get locations for start address
     $daddr = $_GET['daddr'];
     // check for boston and ma
     $daddr = checkString($daddr, $city);
     $daddr = checkString($daddr, $state);
     $ends = getLocations($daddr);
     // log
     if ($logging) {
         logDirectionsQuery($_GET['saddr'], $_GET['daddr']);
     }
     // only one of each, so we can calculate the path
     if (count($starts) == 1 && count($ends) == 1) {
         $start_location = $starts[0];
         $end_location = $ends[0];
         #echo "start_location = " . $start_location . "<br/>";
         #echo "end_location = " . $end_location . "<br/>";
         if ($start_location != false && $end_location != false) {
             // find three closest starting stations
             $start_stations = findNearestStations2($start_location);
             // find three closest ending stations
             $end_stations = findNearestStations2($end_location);
             $path = findDirPath($start_location, $end_location, $start_stations, $end_stations);
         }
     }
Exemplo n.º 2
0
}
if ($debug) {
    echo "*** outgoing ***<br/>";
    echo "type: {$type}<br/>";
    echo "sid: {$sid}<br/>";
    echo "did: {$did}<br/>";
    echo "sa: {$sa}<br/>";
    echo "da: {$da}<br/>";
    echo "time: {$time}<br/>";
    echo "*** end outgoing ***<br/>";
}
// search based on type
if ($type == "dir") {
    // log
    if ($logging) {
        logDirectionsQuery($_GET['sa'], $_GET['da']);
    }
    // correct the strings
    $sa = fixSearchString($sa);
    $da = fixSearchString($da);
    if ($debug) {
        echo "sa: {$sa}<br/>";
        echo "da: {$da}<br/>";
    }
    $sa = validateSearchString($sa, $city, $state);
    $starts = getLocations2($sa);
    $da = validateSearchString($da, $city, $state);
    $ends = getLocations2($da);
    // only one of each, so we can calculate the path
    if (count($starts) == 1 && count($ends) == 1) {
        $start_location = $starts[0];