Add functions to get positions of buses.
This commit is contained in:
parent
3cb626aa44
commit
2aaa44347b
1 changed files with 21 additions and 0 deletions
|
@ -112,4 +112,25 @@ function getLines(){
|
|||
return $lines;
|
||||
}
|
||||
|
||||
function getPositionOfRoute($rt){
|
||||
global $busposition;
|
||||
$locations = array();
|
||||
foreach ($busposition as $bus){
|
||||
if($bus["routeid"] == $rt){
|
||||
array_push($locations,array($bus["lat"],$bus["lon"]));
|
||||
}
|
||||
}
|
||||
return $locations;
|
||||
}
|
||||
|
||||
function getPositionOfLine($line){
|
||||
$locations = array();
|
||||
foreach(getRoutesOfLine($line) as $route){
|
||||
foreach(getPositionOfRoute($route["id"]) as $pos){
|
||||
array_push($locations,$pos);
|
||||
}
|
||||
}
|
||||
return $locations;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
Reference in a new issue