NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

I have a program that downloads and process GPX tracks from OpenStreetMap using:{ID}/data

But how can I find the ID of the latest uploaded GPX file?

Currently I get the ID from:

But that data is mostly meant to be read by humans, and needs a lot of parsing - is there a better way?

asked 08 Sep '10, 07:15

Johnny%20Carlsen's gravatar image

Johnny Carlsen
accept rate: 0%


Your question is fine as it is, but it's very specific. If you can tell us more about what you're trying to do in general, there may be a way of acheiving it without having to scrape the traces page.

(10 Sep '10, 16:23) Jonathan Ben...

Well you can always use the rss feed, just extracting the link element with a regexp will work.



curl |
sed -r 's|.+s/([0-9]+)</link>|\1|;t;d'|
head -1

But compare that to parsing the html page there is almost no gain.



wget -O - "" |
sed '/traces/!d; s|.* href="/user/[^/]*/traces/\([0-9]*\)" .*|\1/data|;t;d'|
head -1
permanent link

answered 10 Sep '10, 12:08

emj's gravatar image

accept rate: 15%

edited 11 Sep '10, 00:03

As the API doesn't seem to have a way of retrieving the newest GPX trace ID, here is an example of a shell command to grab the ID from the traces page:

curl -s "" | grep -m 1 "/edit?gpx=" | cut -d "=" -f3 | cut -d "\"" -f1

But of course this might stop working in the future as the layout of the page may change.

permanent link

answered 08 Sep '10, 10:45

scai's gravatar image

scai ♦
accept rate: 23%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 08 Sep '10, 07:15

question was seen: 6,757 times

last updated: 11 Sep '10, 00:03

NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum