GoBlog can show GPX tracks as SVG now

After my bike tour on Monday, I first felt the usual exhaustion, but later that evening and night, more symptoms joined and showed me, that I, again (third time already this year), caught some infection. Nothing too bad, but it forced me to relax and recover the last two days.

As I can’t watch YouTube or sleep the whole day, I endeavored a little new task. Andrés asked me if I could implement something like James Van Dyne has: A SVG representation of a GPX track.

What was already possible with GoBlog is displaying an interactive map (see my linked post above). However, this has some privacy implications, as you could find out where I live exactly. It is possible to disable the interactive map, but then saving the GPX in GoBlog has no real use.

Taking inspiration from James, I implemented the SVG representation as well. It will be shown when the interactive map is disabled for a post.

As my brain is a bit foggy currently, I asked Claude AI for help, because it usually provides me better programming help than ChatGPT. And it actually provided some adequate code drafts and also helped me customize and refactor the code. After asking why the SVG looked different from the polyline on the Leaflet map, it also provided my with some code for the Web Mercator projection, which I wouldn’t be able to implement in my current state myself. In the end, the SVG generation is less than 35 lines of Go code and is done on-the-fly when rendering a post page.

The SVG is also rendered in GoBlog’s editor preview and finally gives me a way to check the pasted GPX before publishing the post.

(I hope this post makes sense, foggy brain etc…)

Interactions & Comments