Eintrag: Nr. 127 vom 25.08.2012
Stichwörter: Computer, Cooles Zeugs, Freizeit, gpx2svg, Open Source, Programmieren, Python, Releases

How to convert GPX to SVG

Internet forums are full with the question "How can I convert GPX to SVG?" but no really good answer is given. At least, I didn't find one program that "just" does the job. At the end of the day, we're talking about my newly released gpx2svg program and why I had to write it here. Just to have the link in the first line ;-)

What did I want to do?

I tried to convert an OpenStreetMap-extracted coastline of Iceland to an SVG file. Here is the source GPS file, shown by GpsPrune:

GPX file in GpsPrune

What do we have?

There's an online service called gpsvisualizer by which a GPX file can be converted to SVG. It actually could do that with a proper projection, but the output of my dataset was scattered in thousands of small paths, so it was completely unusable.
Then, there is one small piece of code in the OpenStreetMap SVN repository that claims to "spit out a svg file" [sic]. It's called svg.rb and resides in the directory gpx2svg. But apart from the fact it seems to be unmaintained (just a few updates back in 2007) and there's no release, it just didn't work:

This is what I got using the gpx2svg/svg.rb script from the OpenStreetMap SVN repository, viewed with Inkscape:

SVG output of svg.rb

Apparently, the script does also not use the Mercator projection. Notice the top-bottom compression.


Self do, self have. Finally, here's a screenshot of the output of the gpx2svg program I wrote, also viewed with Inkscape. The whole coastline and all the islands around are closed paths that can be filled as-is:

SVG output of svg.rb

The output fitted my needs. Probably, someone else also wants to do such a conversion. If so, have a lot of fun with it :-)

2 Kommentare:

1. Kommentar von Emiel (http://e-miel.nl) vom 17.07.2018, 20.51 Uhr :

Mein Deutsch ist nicht so gut, aber ich werde es probieren.

Für ein Fotobuch möchte ich meine GPX-Route in eine SVG-File konvertieren. Ich habe dann Ihr Programm über Google gefunden und es funktioniert sehr gut.

Vielen Dank für das teilen der Programm und freundliche Grüße aus den Niederlanden!

Mit freundlichen Grüßen

2. Kommentar von Tobias Leupold vom 17.07.2018, 20.56 Uhr :

Schön, wenn es jemandem nutzt :-)

[Kommentare ausblenden]

nasauber.de © 2005–2019 Tobias Leupold | Impressum | Datenschutz