Example #1
0
     // get starting point
     $start_marker = $markers[$_GET['start']];
     if ($debug) {
         $start_marker->printInfo();
     }
     // get ending point
     $end_marker = $markers[$_GET['end']];
     if ($debug) {
         $end_marker->printInfo();
     }
     // log
     if ($logging) {
         logS2SQuery($_GET['start'], $_GET['end']);
     }
     // find the path
     $path = findS2SPath($start_marker, $end_marker);
 } else {
     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
Example #2
0
 $starts = getLocations2($s);
 if ($debug) {
     echo "start locations:<br/>";
     print_r($starts);
     echo "<br/>";
 }
 $ends = getLocations2($e);
 if ($debug) {
     echo "end locations:<br/>";
     print_r($ends);
     echo "<br/>";
 }
 $start_station_marker = getMarker($_GET['start']);
 $end_station_marker = getMarker($_GET['end']);
 // find the path
 $path = findS2SPath($start_station_marker, $end_station_marker);
 // add two segments to the marker
 $start_location = $starts[0];
 $end_location = $ends[0];
 // add the segment directly to the Path.
 // shouldn't because it's a violation of abstraction, but I haven't developed the API yet.
 $start_marker = new Marker($start_location->point->lat, $start_location->point->lng, "start", $start_location->getAddressString());
 $segment = new Segment($start_marker, $start_station_marker, $start_station_marker->lines, distance($start_marker, $start_station_marker) / $WALKING_SPEED, "walking");
 // add segment directly to the beginning of the path
 array_unshift($path->path, $segment);
 $path->time += $segment->t;
 // now add the last marker
 $end_marker = new Marker($end_location->point->lat, $end_location->point->lng, "end", $end_location->getAddressString());
 $segment = new Segment($end_station_marker, $end_marker, null, distance($end_station_marker, $end_marker) / $WALKING_SPEED, "walking");
 $path->addSegment($segment, null);
 // find three closest starting stations