Download public GPS track

I want to ask you a question about public GPS track. How to to download GPS tracks in Italy? Now the track can only be downloaded one by one, please see Public GPS Traces | OpenStreetMap. Thanks very much. My email is bobikeke@qq.com

Hi, You can download GPS traces for an area (bounding box) in JOSM. Then save the GPS layer as a .gpx file. Maybe this will help.

1 Like

Dear BCNorwich,

Thanks very much. One more question, is the website(https://josm.openstreetmap.de/) is right for downloading the JOSM?
And if my system is windows, the 'windows installer" one(as the figure shows) is approriate for me, right?

I would recommend installing OpenWebStart and then downloading and running “josm.jnlp” (on the same page as the Windows installer). That way updates happen automatically.
The way you described should work too, though.

2 Likes

Hi, Yes install Java8, link at the top of the JOSM page, and install JOSM, the Windows Installer. You’ll be told via JOSM when a new version is available. Need more help please just ask.

1 Like

That gave me a shock, seeing “Java 8” there (which I probably wouldn’t suggest anyone ran in 2023, unless there was a really good reason). However, that link actually goes to https://www.azul.com/downloads/?version=java-17-lts&package=jre-fx#download-openjdk which is definitely a sensible option.

1 Like

The English page correctly shows Java 8+, not just Java 8. However, when I looked at the page in other languages like Bulgarian, Catalan, and Danish, it displayed Java 8. Moreover, there seems to be a problem with the link – it’s either incorrect or missing.

2 Likes

Indeed, so it does (for me, in English).

Currently (on an Android phone) it’s suggesting that I download a JDK for Linux, so it’s possible that it’s just confused by whatever you are browsing with.

Personally I’d suggest using package managers across the board (the one from your OS on Linux, chocolatey on Windows and whatever Apple users have these days), but I can understand why JOSM links to a “sensible” version of Java to install directly.

2 Likes

Sorry for not being clear. I meant the pages in other languages like Bulgarian. They only refer to java.com, which isn’t helpful. The English and German pages have the right links.

2 Likes

It is not necessary to download JOSM just to obtain a Bbox with public GPS traces.
You can use the OSM API for GPS traces=
https://wiki.openstreetmap.org/wiki/API_v0.6#:~:text=non-trackable%20traces
You will find a description of the URL configuration to retrieve GPS traces on a Bbox.

You can adjust the parameters of the Bbox about the area you want to get=

https://api.openstreetmap.org/api/0.6/trackpoints?bbox={minlon},{minlat},{maxlon},{maxlat}&page=0

https://api.openstreetmap.org/api/0.6/trackpoints?bbox=left,bottom,right,top&page=pageNumber

4 Likes

You’re right. The api is ok for getting GPS. Where is the parameter description for downloading tracks? e.g., the time of the tracks, the start point of the tracks. I have tried to find the document of details of the API, but I failed. So I just use GPT. Although GPT helps me write the code as follows, I think if there is a document of parameter of downloading GPS tracks, it will more efficient for me to write the code.
The code is:
import os
import requests
from lxml import etree

gpx_files = []
i = 0
while True:
url = f’https://api.openstreetmap.org/api/0.6/trackpoints?bbox=0,51.5,0.25,51.75&time=2023-01-28T00:00:00Z,2023-02-01T00:00:00Z&page={i}
response = requests.get(url)
if response.status_code == 200:
with open(os.path.expanduser(f’D:/life_circle/trackpoints_{i}.gpx’), ‘wb’) as f:
f.write(response.content)
gpx_files.append(os.path.expanduser(f’D:/life_circle/trackpoints_{i}.gpx’))
i += 1
else:
break

root = etree.Element(“gpx”, version=“1.1”, creator=“Bing”)
for gpx_file in gpx_files:
with open(gpx_file, ‘r’) as f:
tree = etree.parse(f)
root.extend(tree.getroot()[1])
with open(os.path.expanduser(f’D:/life_circle/merged_trackpoints.gpx’), ‘wb’) as f:
f.write(etree.tostring(root, pretty_print=True))

D:/life_circle/ can be changed to your path. Hope this code can help you too.

https://api.openstreetmap.org/api/0.6/trackpoints?bbox=0,51.5,0.25,51.75&time=2023-01-28T00:00:00Z,2023-02-01T00:00:00Z&page={i}

Does this request work?
The API chapter related to GPS TRACES does not show any time parameters.
But the chapter related to CHANGESETS does show the time parameters=
“time=T1
Find changesets closed after T1
time=T1,T2
Find changesets that were closed after T1 and created before T2. In other words, any changesets that were open at some time during the given time range T1 to T2.”

That’s why I’m asking if the URL works.
GPT is quite recursive and tends to mix parameters from different elements and the result is a non-functional URL wrapped in a well-constructed header so I imagine that GPT revisited the OSM API and built a query based on the individual capabilities of each OSM element (nodes, notes, CS, GPS traces) and mixed them in one query.
Basically based on the query that was made, GPT took the main base to query “GPS traces” and added the query parameters of time (T1,T2) of “Changesets”

Although a gpx file is downloaded, if you check it carefully you will find traces with dates after the consultation dates.

Although the URL or query may seem to work, I think it does to the extent that the server recognizes the parameters. So basically you’re just querying and getting=

https://api.openstreetmap.org/api/0.6/trackpoints?bbox=0,51.5,0.25,51.75