show route 0
This commit is contained in:
parent
750a4f0505
commit
ed177817e3
2 changed files with 4 additions and 4 deletions
2
app.py
2
app.py
|
@ -20,5 +20,5 @@ routes=",".join(str(r.get("RouteId")) for r in data)
|
|||
@app.route("/tarc.csv")
|
||||
@cache.cached(timeout=5)
|
||||
def tarc():
|
||||
d=requests.get("https://tarc.rideralerts.com/InfoPoint/rest/Vehicles/GetAllVehiclesForRoutes?routeIDs="+routes).json()
|
||||
d=requests.get("https://tarc.rideralerts.com/InfoPoint/rest/Vehicles/GetAllVehiclesForRoutes?routeIDs=0,"+routes).json()
|
||||
return "\n".join(f"{v['Latitude']},{v['Longitude']},{v['RouteId']},{v['Name']},{v['OnBoard']},{v['DirectionLong']},{v['Speed']},{v['LastUpdated'][6:16]}" for v in d)
|
||||
|
|
|
@ -18,9 +18,9 @@ let layerControl=L.control.layers().addTo(map);
|
|||
let busLayers={},busMarkers={};
|
||||
function updateMap(){
|
||||
let routes={};
|
||||
fetch("tarc.csv").then(response=>response.text()).then(data=>{
|
||||
if(data=="")return;
|
||||
data.split("\n").forEach(line=>{
|
||||
fetch("tarc.csv").then(response=>response.text()).then(csv=>{
|
||||
if(csv=="")return;
|
||||
csv.split("\n").forEach(line=>{
|
||||
let [lat,lng,r,id,p,d,s,t]=line.split(",");
|
||||
p=parseInt(p);
|
||||
t=new Date(t*1000).toLocaleTimeString("en-US",{hour12:false});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue