} $ends = getLocations2($da); if ($debug) { echo $ends[0]->printInfo(); } $end_location = $ends[0]; $end_stations = findNearestStations2($end_location); $start_marker = getMarker($sid); if ($debug) { echo $start_marker->printInfo(); } $path = findS2APath($start_marker, $end_stations, $end_location); } else { if ($type == "a2s") { $sa = fixSearchString($sa); $sa = validateSearchString($sa, $city, $state); $starts = getLocations2($sa); $start_location = $starts[0]; $start_stations = findNearestStations2($start_location); if ($debug) { echo $end_location->printInfo(); } $end_marker = getMarker($did); if ($debug) { echo $end_marker->printInfo(); } $path = findA2SPath($start_location, $start_stations, $end_marker); } else { if ($type == "dir_alt") { /* this is new. we generated directions, but the user wants to leave from a different station
} else { $saddr = fixSearchString($saddr); $daddr = fixSearchString($daddr); if ($debug) { echo "saddr: {$saddr}<br/>"; echo "daddr: {$daddr}<br/>"; } // check for new york and ny //$saddr = checkString($saddr, $city); //$saddr = checkString($saddr, $state); $saddr = validateSearchString($saddr, $city, $state); $starts = getLocations2($saddr); // check for new york and ny //$daddr = checkString($daddr, $city); //$daddr = checkString($daddr, $state); $daddr = validateSearchString($daddr, $city, $state); $ends = getLocations2($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