We plan to add it back eventually, but it's not possible currently.
Hello!
And exist any workaround in order to export to GPX (from console or something)?
Kind regards
You can have a script that requests JSON through API and converts it into GPX.
So, as far i now, this https://github.com/zhaofeng-shu33/traccar_gps/tree/067c0807e5e26446e81fd3687928432d7902f676 could do the work, isn't it?
Regards!!
Would be great @Anton Tananaev to get a script.
@Juan Sánchez: What you mentioned also uses the Accept:application/gpx+xml feature which is no longer supported.
And... BTW. It would be great to have Accept:application/gpx+xml back in Traccar :-)
I mocked up this script very fast. Maybe you can use it.
You just have to change the first lines for your need.
import requests
import gpxpy.gpx
from datetime import datetime
base_url = "http://192.168.211.22:8082/api/positions"
traccar_user = "user"
traccar_pass = "password"
traccar_device_id = 1 # 1=phone, 2=car
time_from = "2022-07-13T00:00:00Z"
time_to = "2022-07-19T23:59:59Z"
filename = "tracklog.gpx"
get_parameters = {"deviceId": traccar_device_id, "from": time_from, "to": time_to}
resp = requests.get(base_url, params=get_parameters, auth=(traccar_user, traccar_pass))
gps_points = resp.json()
gpx = gpxpy.gpx.GPX()
# Create first track in our GPX:
gpx_track = gpxpy.gpx.GPXTrack()
gpx.tracks.append(gpx_track)
# Create first segment in our GPX track:
gpx_segment = gpxpy.gpx.GPXTrackSegment()
gpx_track.segments.append(gpx_segment)
for point in gps_points:
dt = datetime.strptime(point["fixTime"], "%Y-%m-%dT%H:%M:%S.000+00:00")
gpx_segment.points.append(gpxpy.gpx.GPXTrackPoint(point["latitude"], point["longitude"], time=dt))
xml = gpx.to_xml()
with open(filename, "wt") as text_file:
n = text_file.write(xml)
As I have a strong need to work with GPX, I have written a small program: traccar2gpx
It provides some features as cleaning the track from "no motion" trackpoints, color to GPX, naming the GPX track.
You can find it here: https://github.com/4tegs/traccar2gpx.
It looks like you only have a binary file. Is there a source code? By the way, Traccar does support GPX export out of the box.
Anton, I cannot find the area where I can export data in GPX-Format (checked the Web-Application and the API documentation) - could you please point me to it? Thanks!
Thanks! That was fast ;-). However if try to read this endpoint
https://xxx.yyy.de/gpx??deviceId=1&from=2024-02-07T15:00:00Z&to=2024-02-08T11:00:00Z
with Postman or python I get an "error" message:
<noscript>Enable JavaScript to use <a href="https://www.traccar.org/">Traccar GPS Tracking System</a>.</noscript>
I assume using js to call the endpoint would be the easiest way out here?
Hi Thomas,
Check my code. It should be obvious then how it’s done. I do it with Python, works well.
Thanks Hans.
Yup, my bad. My endpoint url was wrong; works like a charm now - many thanks for the superfast responses here.
Hello,
I want to export to GPX file but i don't see any option since 4.13 (More or less).
It's something that will return or it will be impossible to export to GPX format now?
Kind Regards!