Departure time on tripplanner bus steps
--- a/include/common-geo.inc.php
+++ b/include/common-geo.inc.php
@@ -13,14 +13,11 @@
$metersperpixel[13] = 19.093 * $width;
$metersperpixel[14] = 9.547 * $width;
$metersperpixel[15] = 4.773 * $width;
- $metersperpixel[16] = 2.387 * $width;
+ //$metersperpixel[16] = 2.387 * $width;
// $metersperpixel[17]=1.193*$width;
$center = "";
$markers = "";
- $minlat = 999;
- $minlon = 999;
- $maxlat = 0;
- $maxlon = 0;
+ $mapwidthinmeters = 50;
if (sizeof($mapPoints) < 1) return "map error";
if (sizeof($mapPoints) === 1) {
if ($zoom == 0) $zoom = 14;
@@ -31,17 +28,15 @@
foreach ($mapPoints as $index => $mapPoint) {
$markers.= $mapPoint[0] . "," . $mapPoint[1] . "," . $markerImage . ($index + 1);
if ($index + 1 != sizeof($mapPoints)) $markers.= "|";
- if ($mapPoint[0] < $minlat) $minlat = $mapPoint[0];
- if ($mapPoint[0] > $maxlat) $maxlat = $mapPoint[0];
- if ($mapPoint[1] < $minlon) $minlon = $mapPoint[1];
- if ($mapPoint[1] > $maxlon) $maxlon = $mapPoint[1];
+ $dist = distance($mapPoints[0][0], $mapPoint[0][1],$mapPoint[0], $mapPoint[1]);
+ $mapwidthinmeters = ($dist>$mapwidthinmeters ? $dist : $mapwidthinmeters);
$totalLat+= $mapPoint[0];
$totalLon+= $mapPoint[1];
}
if ($zoom == 0) {
$mapwidthinmeters = distance($minlat, $minlon, $minlat, $maxlon);
foreach (array_reverse($metersperpixel, true) as $zoomLevel => $maxdistance) {
- if ($zoom == 0 && $mapwidthinmeters < ($maxdistance + 50)) $zoom = $zoomLevel;
+ if ($zoom == 0 && $mapwidthinmeters*1.5 < ($maxdistance)) $zoom = $zoomLevel;
}
}
$center = $totalLat / sizeof($mapPoints) . "," . $totalLon / sizeof($mapPoints);
--- a/include/common.inc.php
+++ b/include/common.inc.php
@@ -6,7 +6,7 @@
"phperror",
"awsotp",
//"squallotp",
- "vanilleotp",
+ //"vanilleotp",
"database",
"other"
);
--- a/tripPlanner.php
+++ b/tripPlanner.php
@@ -77,7 +77,7 @@
$legArray = object2array($leg);
echo '<h3>Leg #' . ($legNumber + 1) . " ( {$legArray['@mode']} from: {$leg->from->name} to {$leg->to->name}, " . floor($leg->duration / 60000) . " minutes) </h3>\n";
if ($legArray["@mode"] === "BUS") {
- echo "Take bus {$legArray['@route']} " . str_replace("To", "towards", $legArray['@headsign']) . "<br>";
+ echo "Take bus {$legArray['@route']} " . str_replace("To", "towards", $legArray['@headsign']) . " departing at ". formatTime($leg->startTime)."<br>";
}
else {
$walkStepMarkers = array();