-
Notifications
You must be signed in to change notification settings - Fork 736
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gpx export #993
Gpx export #993
Conversation
Cool! I really like the simplicity of the integration with the dashboard. |
fab6cb4
to
f1c8b61
Compare
I think it might be tested enough now, but as always, if you have any concerns, let me know :) In the future it might be better to have a real gpx library/implementation, since i'm really not sure what I'm breaking with this. |
Is there anything I should do or you want to have improved? :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alias TeslaMate.Repo | ||
|
||
def gpx(conn, %{"id" => id}) do | ||
drive = Repo.get(Drive, id) |> Repo.preload(:positions) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we cannot rely on the standard sorting:
import Ecto.Query
drive =
Drive
|> Repo.get(id)
|> Repo.preload(positions: from(p in TeslaMate.Log.Position, order_by: p.date))
longitude: 10.0, | ||
elevation: 200 | ||
}) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To test the date-based sorting, a third Position
with a date in the past could be inserted here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done as suggested :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! 🙏
Hello, is it also possible to export all trips to a GPX file - i.e. my complete TeslaMate. Preferably a GPX file for every trip. The way I see it, this is currently only possible manual? |
Yes, currently this would only be possible manually/programmatically. You could write a script that iterates over ids |
The the answer. Unfortunately I can't program, so I hope that an export function will come up. |
That caught me. Pls find attached a small python3 script. You need to install python3-psycopg2, either with Then you need to call it with the drive id... It writes the route to out.xml. |
Ok, I tweeked it a bit. Now it asks for From, To and CarID. If you give an empty input, then it defaults to last 24 hours and car no 1. It now produces a track for every drive. |
Unfortunately I don't understand the file. I can neither query database nor program. Wouldn't it be great to have a button to download all the tracks directly from the website with the push of a button? For example, I downloaded all my training sessions from Apple Health as a ZIP file and then put them together and have everything directly in Google Earth. What would I like in TeslaMate. It would also be an idea that this is installed under TRIP? You can already select the start date and end date and then the card is there. Only a new button "Export GPX" would have to be installed here. |
The current prototype exposes an endpoint to download a drive as a gpx file.
The drive details dashboard would have a link to the endpoint, so you could directly download the file from the dashboard.
As a note: I don't exactly know the details and features of GPX but as a minimal solution a list of trackpoints should be sufficient.
This is an effort to implement #722
Todos: