Skip to content

Instantly share code, notes, and snippets.

@joaofig
Created June 17, 2023 11:31
Show Gist options
  • Select an option

  • Save joaofig/0bf754b5c1bcdd29b0bd903cedfafe59 to your computer and use it in GitHub Desktop.

Select an option

Save joaofig/0bf754b5c1bcdd29b0bd903cedfafe59 to your computer and use it in GitHub Desktop.
Loads the GPS trajectory points from the database.
def load_trajectory_points(traj_id):
db = EVedDb()
sql = f"""
select distinct
s.latitude as lat
, s.longitude as lon
, min(s.time_stamp) / 1000 as time
from signal s
inner join trajectory t on s.vehicle_id = t.vehicle_id and s.trip_id = t.trip_id
where t.traj_id = ?
group by s.latitude, s.longitude
order by s.time_stamp;
"""
return db.query_df(sql, [traj_id])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment