Add description popups for trip times
Add description popups for trip times

<?php <?php
date_default_timezone_set('Australia/ACT'); date_default_timezone_set('Australia/ACT');
$debugOkay = Array( $debugOkay = Array(
"session", "session",
"json", "json",
"phperror", "phperror",
"awsotp", "awsotp",
//"squallotp", //"squallotp",
//"vanilleotp", "vanilleotp",
"database", "database",
"other" "other"
); );
$cloudmadeAPIkey = "daa03470bb8740298d4b10e3f03d63e6"; $cloudmadeAPIkey = "daa03470bb8740298d4b10e3f03d63e6";
$googleMapsAPIkey = "ABQIAAAA95XYXN0cki3Yj_Sb71CFvBTPaLd08ONybQDjcH_VdYtHHLgZvRTw2INzI_m17_IoOUqH3RNNmlTk1Q"; $googleMapsAPIkey = "ABQIAAAA95XYXN0cki3Yj_Sb71CFvBTPaLd08ONybQDjcH_VdYtHHLgZvRTw2INzI_m17_IoOUqH3RNNmlTk1Q";
$otpAPIurl = 'http://localhost:8080/opentripplanner-api-webapp/'; $otpAPIurl = 'http://localhost:8080/opentripplanner-api-webapp/';
if (isDebug("awsotp") || php_uname('n') == "maxious.xen.prgmr.com") { if (isDebug("awsotp") || php_uname('n') == "maxious.xen.prgmr.com") {
$otpAPIurl = 'http://bus-main.lambdacomplex.org:8080/opentripplanner-api-webapp/'; $otpAPIurl = 'http://bus-main.lambdacomplex.org:8080/opentripplanner-api-webapp/';
} }
if (isDebug("dotcloudotp") || php_uname('n') == "actbus-www") { if (isDebug("dotcloudotp") || php_uname('n') == "actbus-www") {
$otpAPIurl = 'http://otp.actbus.dotcloud.com/opentripplanner-api-webapp/'; $otpAPIurl = 'http://otp.actbus.dotcloud.com/opentripplanner-api-webapp/';
} }
if (isDebug("squallotp")) { if (isDebug("squallotp")) {
$otpAPIurl = 'http://10.0.1.108:5080/opentripplanner-api-webapp/'; $otpAPIurl = 'http://10.0.1.108:5080/opentripplanner-api-webapp/';
} }
if (isDebug("vanilleotp")) { if (isDebug("vanilleotp")) {
$otpAPIurl = 'http://10.0.1.135:8080/opentripplanner-api-webapp/'; $otpAPIurl = 'http://10.0.1.135:8080/opentripplanner-api-webapp/';
} }
if (isDebug("phperror")) error_reporting(E_ALL ^ E_NOTICE); if (isDebug("phperror")) error_reporting(E_ALL ^ E_NOTICE);
   
include_once ("common-geo.inc.php"); include_once ("common-geo.inc.php");
include_once ("common-net.inc.php"); include_once ("common-net.inc.php");
include_once ("common-transit.inc.php"); include_once ("common-transit.inc.php");
include_once ("common-session.inc.php"); include_once ("common-session.inc.php");
include_once ("common-db.inc.php"); include_once ("common-db.inc.php");
include_once ("common-template.inc.php"); include_once ("common-template.inc.php");
   
function isDebugServer() function isDebugServer()
{ {
return $_SERVER['SERVER_NAME'] == "10.0.1.154" || $_SERVER['SERVER_NAME'] == "localhost" || $_SERVER['SERVER_NAME'] == "127.0.0.1" || !$_SERVER['SERVER_NAME']; return $_SERVER['SERVER_NAME'] == "10.0.1.154" || $_SERVER['SERVER_NAME'] == "localhost" || $_SERVER['SERVER_NAME'] == "127.0.0.1" || !$_SERVER['SERVER_NAME'];
} }
function isAnalyticsOn() function isAnalyticsOn()
{ {
return !isDebugServer(); return !isDebugServer();
} }
function isDebug($debugReason = "other") function isDebug($debugReason = "other")
{ {
global $debugOkay; global $debugOkay;
return in_array($debugReason, $debugOkay, false) && isDebugServer(); return in_array($debugReason, $debugOkay, false) && isDebugServer();
} }
function debug($msg, $debugReason = "other") function debug($msg, $debugReason = "other")
{ {
if (isDebug($debugReason)) echo "\n<!-- " . date(DATE_RFC822) . "\n $msg -->\n"; if (isDebug($debugReason)) echo "\n<!-- " . date(DATE_RFC822) . "\n $msg -->\n";
} }
function isJQueryMobileDevice() function isJQueryMobileDevice()
{ {
// http://forum.jquery.com/topic/what-is-the-best-way-to-detect-all-useragents-which-can-handle-jquery-mobile#14737000002087897 // http://forum.jquery.com/topic/what-is-the-best-way-to-detect-all-useragents-which-can-handle-jquery-mobile#14737000002087897
$user_agent = $_SERVER['HTTP_USER_AGENT']; $user_agent = $_SERVER['HTTP_USER_AGENT'];
return preg_match('/iphone/i', $user_agent) || preg_match('/android/i', $user_agent) || preg_match('/webos/i', $user_agent) || preg_match('/ios/i', $user_agent) || preg_match('/bada/i', $user_agent) || preg_match('/maemo/i', $user_agent) || preg_match('/meego/i', $user_agent) || preg_match('/fennec/i', $user_agent) || (preg_match('/symbian/i', $user_agent) && preg_match('/s60/i', $user_agent) && $browser['majorver'] >= 5) || (preg_match('/symbian/i', $user_agent) && preg_match('/platform/i', $user_agent) && $browser['majorver'] >= 3) || (preg_match('/blackberry/i', $user_agent) && $browser['majorver'] >= 5) || (preg_match('/opera mobile/i', $user_agent) && $browser['majorver'] >= 10) || (preg_match('/opera mini/i', $user_agent) && $browser['majorver'] >= 5); return preg_match('/iphone/i', $user_agent) || preg_match('/android/i', $user_agent) || preg_match('/webos/i', $user_agent) || preg_match('/ios/i', $user_agent) || preg_match('/bada/i', $user_agent) || preg_match('/maemo/i', $user_agent) || preg_match('/meego/i', $user_agent) || preg_match('/fennec/i', $user_agent) || (preg_match('/symbian/i', $user_agent) && preg_match('/s60/i', $user_agent) && $browser['majorver'] >= 5) || (preg_match('/symbian/i', $user_agent) && preg_match('/platform/i', $user_agent) && $browser['majorver'] >= 3) || (preg_match('/blackberry/i', $user_agent) && $browser['majorver'] >= 5) || (preg_match('/opera mobile/i', $user_agent) && $browser['majorver'] >= 10) || (preg_match('/opera mini/i', $user_agent) && $browser['majorver'] >= 5);
} }
function isFastDevice() function isFastDevice()
{ {
$ua = $_SERVER['HTTP_USER_AGENT']; $ua = $_SERVER['HTTP_USER_AGENT'];
$fastDevices = Array( $fastDevices = Array(
"Mozilla/5.0 (X11;", "Mozilla/5.0 (X11;",
"Mozilla/5.0 (Windows;", "Mozilla/5.0 (Windows;",
"Mozilla/5.0 (iP", "Mozilla/5.0 (iP",
"Mozilla/5.0 (Linux; U; Android", "Mozilla/5.0 (Linux; U; Android",
"Mozilla/4.0 (compatible; MSIE" "Mozilla/4.0 (compatible; MSIE"
); );
$slowDevices = Array( $slowDevices = Array(
"J2ME", "J2ME",
"MIDP", "MIDP",
"Opera/", "Opera/",
"Mozilla/2.0 (compatible;", "Mozilla/2.0 (compatible;",
"Mozilla/3.0 (compatible;" "Mozilla/3.0 (compatible;"
); );
return true; return true;
} }
function array_flatten($a, $f = array()) function array_flatten($a, $f = array())
{ {
if (!$a || !is_array($a)) return ''; if (!$a || !is_array($a)) return '';
foreach ($a as $k => $v) { foreach ($a as $k => $v) {
if (is_array($v)) $f = array_flatten($v, $f); if (is_array($v)) $f = array_flatten($v, $f);
else $f[$k] = $v; else $f[$k] = $v;
} }
return $f; return $f;
} }
function remove_spaces($string) function remove_spaces($string)
{ {
return str_replace(' ', '', $string); return str_replace(' ', '', $string);
} }
function object2array($object) function object2array($object)
{ {
if (is_object($object)) { if (is_object($object)) {
foreach ($object as $key => $value) { foreach ($object as $key => $value) {
$array[$key] = $value; $array[$key] = $value;
} }
} }
else { else {
$array = $object; $array = $object;
} }
return $array; return $array;
} }
function startsWith($haystack, $needle, $case = true) function startsWith($haystack, $needle, $case = true)
{ {
if ($case) { if ($case) {
return (strcmp(substr($haystack, 0, strlen($needle)) , $needle) === 0); return (strcmp(substr($haystack, 0, strlen($needle)) , $needle) === 0);
} }
return (strcasecmp(substr($haystack, 0, strlen($needle)) , $needle) === 0); return (strcasecmp(substr($haystack, 0, strlen($needle)) , $needle) === 0);
} }
   
function endsWith($haystack, $needle, $case = true) function endsWith($haystack, $needle, $case = true)
{ {
if ($case) { if ($case) {
return (strcmp(substr($haystack, strlen($haystack) - strlen($needle)) , $needle) === 0); return (strcmp(substr($haystack, strlen($haystack) - strlen($needle)) , $needle) === 0);
} }
return (strcasecmp(substr($haystack, strlen($haystack) - strlen($needle)) , $needle) === 0); return (strcasecmp(substr($haystack, strlen($haystack) - strlen($needle)) , $needle) === 0);
} }
function bracketsMeanNewLine($input) function bracketsMeanNewLine($input)
{ {
return str_replace(")", "</small>", str_replace("(", "<br><small>", $input)); return str_replace(")", "</small>", str_replace("(", "<br><small>", $input));
} }
function sksort(&$array, $subkey = "id", $sort_ascending = false) function sksort(&$array, $subkey = "id", $sort_ascending = false)
{ {
if (count($array)) $temp_array[key($array) ] = array_shift($array); if (count($array)) $temp_array[key($array) ] = array_shift($array);
foreach ($array as $key => $val) { foreach ($array as $key => $val) {
$offset = 0; $offset = 0;
$found = false; $found = false;
foreach ($temp_array as $tmp_key => $tmp_val) { foreach ($temp_array as $tmp_key => $tmp_val) {
if (!$found and strtolower($val[$subkey]) > strtolower($tmp_val[$subkey])) { if (!$found and strtolower($val[$subkey]) > strtolower($tmp_val[$subkey])) {
$temp_array = array_merge((array)array_slice($temp_array, 0, $offset) , array( $temp_array = array_merge((array)array_slice($temp_array, 0, $offset) , array(
$key => $val $key => $val
) , array_slice($temp_array, $offset)); ) , array_slice($temp_array, $offset));
$found = true; $found = true;
} }
$offset++; $offset++;
} }
if (!$found) $temp_array = array_merge($temp_array, array( if (!$found) $temp_array = array_merge($temp_array, array(
$key => $val $key => $val
)); ));
} }
if ($sort_ascending) $array = array_reverse($temp_array); if ($sort_ascending) $array = array_reverse($temp_array);
else $array = $temp_array; else $array = $temp_array;
} }
function sktimesort(&$array, $subkey = "id", $sort_ascending = false) function sktimesort(&$array, $subkey = "id", $sort_ascending = false)
{ {
if (count($array)) $temp_array[key($array) ] = array_shift($array); if (count($array)) $temp_array[key($array) ] = array_shift($array);
foreach ($array as $key => $val) { foreach ($array as $key => $val) {
$offset = 0; $offset = 0;
$found = false; $found = false;
foreach ($temp_array as $tmp_key => $tmp_val) { foreach ($temp_array as $tmp_key => $tmp_val) {
if (!$found and strtotime($val[$subkey]) > strtotime($tmp_val[$subkey])) { if (!$found and strtotime($val[$subkey]) > strtotime($tmp_val[$subkey])) {
$temp_array = array_merge((array)array_slice($temp_array, 0, $offset) , array( $temp_array = array_merge((array)array_slice($temp_array, 0, $offset) , array(
$key => $val $key => $val
) , array_slice($temp_array, $offset)); ) , array_slice($temp_array, $offset));
$found = true; $found = true;
} }
$offset++; $offset++;
} }
if (!$found) $temp_array = array_merge($temp_array, array( if (!$found) $temp_array = array_merge($temp_array, array(
$key => $val $key => $val
)); ));
} }
if ($sort_ascending) $array = array_reverse($temp_array); if ($sort_ascending) $array = array_reverse($temp_array);
else $array = $temp_array; else $array = $temp_array;
} }
function r_implode( $glue, $pieces ) function r_implode( $glue, $pieces )
{ {
foreach( $pieces as $r_pieces ) foreach( $pieces as $r_pieces )
{ {
if( is_array( $r_pieces ) ) if( is_array( $r_pieces ) )
{ {
$retVal[] = r_implode( $glue, $r_pieces ); $retVal[] = r_implode( $glue, $r_pieces );
} }
else else
{ {
$retVal[] = $r_pieces; $retVal[] = $r_pieces;
} }
} }
return implode( $glue, $retVal ); return implode( $glue, $retVal );
} }
?> ?>
   
<?php <?php
// http://www.herethere.net/~samson/php/color_gradient/color_gradient_generator.php.txt // http://www.herethere.net/~samson/php/color_gradient/color_gradient_generator.php.txt
// return the interpolated value between pBegin and pEnd // return the interpolated value between pBegin and pEnd
function interpolate($pBegin, $pEnd, $pStep, $pMax) function interpolate($pBegin, $pEnd, $pStep, $pMax)
{ {
if ($pBegin < $pEnd) { if ($pBegin < $pEnd) {
return (($pEnd - $pBegin) * ($pStep / $pMax)) + $pBegin; return (($pEnd - $pBegin) * ($pStep / $pMax)) + $pBegin;
} }
else { else {
return (($pBegin - $pEnd) * (1 - ($pStep / $pMax))) + $pEnd; return (($pBegin - $pEnd) * (1 - ($pStep / $pMax))) + $pEnd;
} }
} }
require ("../lib/rolling-curl/RollingCurl.php"); require ("../lib/rolling-curl/RollingCurl.php");
function processResult_cb($response, $info, $request) function processResult_cb($response, $info, $request)
{ {
global $testRegions, $regionTimes,$csv,$kml, $latdeltasize,$londeltasize; global $testRegions, $regionTimes,$csv,$kml, $latdeltasize,$londeltasize;
$md = $request->metadata; $md = $request->metadata;
$tripplan = json_decode($response); $tripplan = json_decode($response);
$plans = Array(); $plans = Array();
//var_dump(Array($info, $request)); //var_dump(Array($info, $request));
if (is_array($tripplan->plan->itineraries->itinerary)) { if (is_array($tripplan->plan->itineraries->itinerary)) {
foreach ($tripplan->plan->itineraries->itinerary as $itineraryNumber => $itinerary) { foreach ($tripplan->plan->itineraries->itinerary as $itineraryNumber => $itinerary) {
$plans[floor($itinerary->duration / 60000) ] = $itinerary; $plans[floor($itinerary->duration / 60000) ] = $itinerary;
} }
} }
else { else {
$plans[floor($tripplan->plan->itineraries->itinerary->duration / 60000) ] = $tripplan->plan->itineraries->itinerary; $plans[floor($tripplan->plan->itineraries->itinerary->duration / 60000) ] = $tripplan->plan->itineraries->itinerary;
} }
if ($csv) echo "{$md['i']},{$md['j']}," . min(array_keys($plans)) . ",$latdeltasize, $londeltasize,{$md['key']}\n"; if ($csv) echo "{$md['i']},{$md['j']}," . min(array_keys($plans)) . ",$latdeltasize, $londeltasize,{$md['key']}\n";
if ($kml) { if ($kml) {
$time = min(array_keys($plans)); $time = min(array_keys($plans));
$plan = ""; $plan = "";
if (is_array($plans[min(array_keys($plans)) ]->legs->leg)) { if (is_array($plans[min(array_keys($plans)) ]->legs->leg)) {
foreach ($plans[min(array_keys($plans)) ]->legs->leg as $legNumber => $leg) { foreach ($plans[min(array_keys($plans)) ]->legs->leg as $legNumber => $leg) {
$plan.= processLeg($legNumber, $leg) . ","; $plan.= processLeg($legNumber, $leg) . ",";
} }
} }
else { else {
$plan.= processLeg(0, $plans[min(array_keys($plans)) ]->legs->leg); $plan.= processLeg(0, $plans[min(array_keys($plans)) ]->legs->leg);
} }
if (isset($tripplan->error) && $tripplan->error->id == 404) { if (isset($tripplan->error) && $tripplan->error->id == 404) {
$time = 999; $time = 999;
$plan = "Trip not possible without excessive walking from nearest bus stop"; $plan = "Trip not possible without excessive walking from nearest bus stop";
} }
$testRegions[] = Array( $testRegions[] = Array(
"lat" => $md['i'], "lat" => $md['i'],
"lon" => $md['j'], "lon" => $md['j'],
"time" => $time, "time" => $time,
"latdeltasize" => $latdeltasize, "latdeltasize" => $latdeltasize,
"londeltasize" => $londeltasize, "londeltasize" => $londeltasize,
"regionname" => $md['key'], "regionname" => $md['key'],
"plan" => $plan . "<br/><a href='" . htmlspecialchars($url) . "'>original plan</a>" "plan" => $plan . '<br/><a href="' . htmlspecialchars($md['url']) . '">original plan</a>'
); );
$regionTimes[] = $time; $regionTimes[] = $time;
} }
} }
function Gradient($HexFrom, $HexTo, $ColorSteps) function Gradient($HexFrom, $HexTo, $ColorSteps)
{ {
$theColorBegin = hexdec($HexFrom); $theColorBegin = hexdec($HexFrom);
$theColorEnd = hexdec($HexTo); $theColorEnd = hexdec($HexTo);
$theNumSteps = intval($ColorSteps); $theNumSteps = intval($ColorSteps);
$theR0 = ($theColorBegin & 0xff0000) >> 16; $theR0 = ($theColorBegin & 0xff0000) >> 16;
$theG0 = ($theColorBegin & 0x00ff00) >> 8; $theG0 = ($theColorBegin & 0x00ff00) >> 8;
$theB0 = ($theColorBegin & 0x0000ff) >> 0; $theB0 = ($theColorBegin & 0x0000ff) >> 0;
$theR1 = ($theColorEnd & 0xff0000) >> 16; $theR1 = ($theColorEnd & 0xff0000) >> 16;
$theG1 = ($theColorEnd & 0x00ff00) >> 8; $theG1 = ($theColorEnd & 0x00ff00) >> 8;
$theB1 = ($theColorEnd & 0x0000ff) >> 0; $theB1 = ($theColorEnd & 0x0000ff) >> 0;
$GradientColors = array(); $GradientColors = array();
// generate gradient swathe now // generate gradient swathe now
for ($i = 0; $i <= $theNumSteps; $i++) { for ($i = 0; $i <= $theNumSteps; $i++) {
$theR = interpolate($theR0, $theR1, $i, $theNumSteps); $theR = interpolate($theR0, $theR1, $i, $theNumSteps);
$theG = interpolate($theG0, $theG1, $i, $theNumSteps); $theG = interpolate($theG0, $theG1, $i, $theNumSteps);
$theB = interpolate($theB0, $theB1, $i, $theNumSteps); $theB = interpolate($theB0, $theB1, $i, $theNumSteps);
$theVal = ((($theR << 8) | $theG) << 8) | $theB; $theVal = ((($theR << 8) | $theG) << 8) | $theB;
$GradientColors[] = sprintf("%06X", $theVal); $GradientColors[] = sprintf("%06X", $theVal);
} }
return $GradientColors; return $GradientColors;
} }
function processLeg($legNumber, $leg) function processLeg($legNumber, $leg)
{ {
$legArray = object2array($leg); $legArray = object2array($leg);
if ($legArray["@mode"] === "BUS") { if ($legArray["@mode"] === "BUS") {
return "bus {$legArray['@route']} " . str_replace("To", "towards", $legArray['@headsign']); return "bus {$legArray['@route']} " . str_replace("To", "towards", $legArray['@headsign']);
} }
else { else {
return "walk"; return "walk";
//$walkingstep = "walk "; //$walkingstep = "walk ";
//if (strpos($step->streetName, "from") !== false && strpos($step->streetName, "way") !== false) { //if (strpos($step->streetName, "from") !== false && strpos($step->streetName, "way") !== false) {
// $walkingstep.= "footpath"; // $walkingstep.= "footpath";
//} //}
//else { //else {
// $walkingstep.= $step->streetName; // $walkingstep.= $step->streetName;
//} //}
//$walkingstep.= floor($step->distance) . "m"; //$walkingstep.= floor($step->distance) . "m";
//return $walkingstep; //return $walkingstep;
} }
} }
$csv = false; $csv = false;
$kml = true; $kml = true;
$gearthcolors = false; $gearthcolors = false;
if ($kml) { if ($kml) {
header('Content-Type: application/vnd.google-earth.kml+xml'); header('Content-Type: application/vnd.google-earth.kml+xml');
echo '<?xml version="1.0" encoding="UTF-8"?> echo '<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2"><Document>'; <kml xmlns="http://www.opengis.net/kml/2.2"><Document>';
} }
include ('../include/common.inc.php'); include ('../include/common.inc.php');
$boundingBoxes = Array( $boundingBoxes = Array(
"belconnen" => Array( "belconnen" => Array(
"startlat" => - 35.1928, "startlat" => - 35.1928,
"startlon" => 149.006, "startlon" => 149.006,
"finishlat" => - 35.2630, "finishlat" => - 35.2630,
"finishlon" => 149.1045, "finishlon" => 149.1045,
) , ) ,
"north gungahlin civic" => Array( "north gungahlin civic" => Array(
"startlat" => - 35.1828, "startlat" => - 35.1828,
"startlon" => 149.1045, "startlon" => 149.1045,
"finishlat" => - 35.2955, "finishlat" => - 35.2955,
"finishlon" => 149.1559, "finishlon" => 149.1559,
) , ) ,
"west duffy" => Array( "west duffy" => Array(
"startlat" => - 35.3252, "startlat" => - 35.3252,
"startlon" => 149.0240, "startlon" => 149.0240,
"finishlat" => - 35.3997, "finishlat" => - 35.3997,
"finishlon" => 149.0676, "finishlon" => 149.0676,
) , ) ,
"central south" => Array( "central south" => Array(
"startlat" => - 35.3042, "startlat" => - 35.3042,
"startlon" => 149.0762, "startlon" => 149.0762,
"finishlat" => - 35.3370, "finishlat" => - 35.3370,
"finishlon" => 149.1806, "finishlon" => 149.1806,
) , ) ,
"south" => Array( "south" => Array(
"startlat" => - 35.3403, "startlat" => - 35.3403,
"startlon" => 149.0714, "startlon" => 149.0714,
"finishlat" => - 35.4607, "finishlat" => - 35.4607,
"finishlon" => 149.1243, "finishlon" => 149.1243,
) )
); );
$latdeltasize = 0.025; $latdeltasize = 0.005;
$londeltasize = 0.025; $londeltasize = 0.005;
$from = "Wattle Street"; $from = "Wattle Street";
$fromPlace = (startsWith($from, "-") ? $from : geocode($from, false)); $fromPlace = (startsWith($from, "-") ? $from : geocode($from, false));
$startTime = "9:00 am"; $startTime = "9:00 am";
$startDate = "03/21/2011"; // american dates, OTP does not validate! $startDate = "03/21/2011"; // american dates, OTP does not validate!
$counter = 0; $counter = 0;
$regionTimes = Array(); $regionTimes = Array();
$testRegions = Array(); $testRegions = Array();
$useragent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1"; $useragent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1";
  if ($kml) echo "<name> $from at $startTime on $startDate </name>";
if ($csv) echo "<pre>"; if ($csv) echo "<pre>";
if ($csv) echo "lat,lon,time,latdeltasize, londeltasize, region key name\n"; if ($csv) echo "lat,lon,time,latdeltasize, londeltasize, region key name\n";
$rc = new RollingCurl("processResult_cb"); $rc = new RollingCurl("processResult_cb");
$rc->window_size = 2; $rc->window_size = 2;
foreach ($boundingBoxes as $key => $boundingBox) { foreach ($boundingBoxes as $key => $boundingBox) {
for ($i = $boundingBox['startlat']; $i >= $boundingBox['finishlat']; $i-= $latdeltasize) { for ($i = $boundingBox['startlat']; $i >= $boundingBox['finishlat']; $i-= $latdeltasize) {
for ($j = $boundingBox['startlon']; $j <= $boundingBox['finishlon']; $j+= $londeltasize) { for ($j = $boundingBox['startlon']; $j <= $boundingBox['finishlon']; $j+= $londeltasize) {
$url = $otpAPIurl . "ws/plan?date=" . urlencode($startDate) . "&time=" . urlencode($startTime) . "&mode=TRANSIT%2CWALK&optimize=QUICK&maxWalkDistance=440&wheelchair=false&toPlace=" . $i . "," . $j . "&fromPlace=$fromPlace"; $url = $otpAPIurl . "ws/plan?date=" . urlencode($startDate) . "&time=" . urlencode($startTime) . "&mode=TRANSIT%2CWALK&optimize=QUICK&maxWalkDistance=440&wheelchair=false&toPlace=" . $i . "," . $j . "&fromPlace=$fromPlace";
  //debug($url);