From 2c1bd918dedf045763f3d72d295df76675f72d55 Mon Sep 17 00:00:00 2001 From: George Kaklamanos Date: Sun, 21 Feb 2016 14:00:25 +0200 Subject: [PATCH] Only download the requested bus data dynamically. --- modules/libdata.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/modules/libdata.php b/modules/libdata.php index 6ecf7ff..584eede 100644 --- a/modules/libdata.php +++ b/modules/libdata.php @@ -114,12 +114,9 @@ function getLines(){ } function getPositionOfRoute($rt,$direction){ - global $buspositions; $locations = array(); - foreach ($buspositions as $bus){ - if($bus["routeid"] == $rt && $bus["direction"] == $direction){ - array_push($locations,array($bus["lat"],$bus["lon"])); - } + foreach (BusPosition($rt,$direction) as $bus){ + array_push($locations,array($bus["lat"],$bus["lon"])); } return $locations; }