{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreiadnigahjuidpfwcqdpb24nr2rzwxsma4y7snjrzzjllwuvgcddxy",
"uri": "at://did:plc:46ti67tc37qcmwp2vaynk6fq/app.bsky.feed.post/3mipoykqly332"
},
"path": "/notes/2026/04/04_simple-gpx-export-from-ridewithgps.html",
"publishedAt": "2026-04-05T02:23:40.585Z",
"site": "http://notes.secretsauce.net",
"tags": [
"Tour de Los Padres",
"the route on\nridewithgps",
"https://caltopo.com/m/DB6HBQ1"
],
"textContent": "The Tour de Los Padres is coming! The race organizer post the route on\nridewithgps. This works, but has convoluted interfaces for people not wanting to use their service. I just wrote a simple script to export their data into a plain .gpx file, _including_ all the waypoints. Their exporter omits those.\n\nThe `gpx-from-ridewithgps.py` script:\n\n\n #!/usr/bin/python3\n import sys\n import json\n\n def quote_xml(s):\n return s.replace(\"&\", \"&\").replace(\"<\", \"<\").replace(\">\", \">\")\n\n print(\"Reading stdin\", file=sys.stderr)\n\n data = json.load(sys.stdin)\n\n print(r\"\"\"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <gpx version=\"1.1\" creator=\"gpx-from-ridewithgps.py\" xmlns=\"http://www.topografix.com/GPX/1/1\">\"\"\")\n\n for item in data[\"extras\"]:\n if item[\"type\"] != \"point_of_interest\":\n continue\n poi = item[\"point_of_interest\"]\n print(f' <wpt lat=\"{poi[\"lat\"]}\" lon=\"{poi[\"lng\"]}\">')\n print(f' <name>{quote_xml(poi[\"name\"])}</name>')\n\n desc = poi.get(\"description\",\"\")\n if len(desc):\n print(f' <desc>{quote_xml(desc)}</desc>')\n print(f' </wpt>')\n\n print(\" <trk><trkseg>\")\n for pt in data.get(\"route\", {}).get(\"track_points\", []):\n print(f' <trkpt lat=\"{pt[\"y\"]}\" lon=\"{pt[\"x\"]}\"><ele>{pt[\"e\"]}</ele></trkpt>')\n print(\" </trkseg></trk>\")\n\n print(\"</gpx>\")\n\n\nYou invoke it by downloading the route and feeding it into the script:\n\n\n curl -s https://ridewithgps.com/routes/54493422.json | ./ridewithgps-to-gpx.py > out.gpx\n\n\nNote that the route number 54493422 is in the url above. I uploaded this to caltopo for analysis, and _easy_ downloading by others:\n\nhttps://caltopo.com/m/DB6HBQ1",
"title": "Dima Kogan: Simple gpx export from ridewithgps",
"updatedAt": "2026-04-05T00:21:00.000Z"
}