[Keine deutsche Version verfügbar]


gpx2svg does, as the name implies, convert GPX data to SVG data. The Mercator Projection is used to translate the GPS latitude and longitude values to Cartesian coordinates. It's the same projection widely used by different map providers, e. g. OpenStreetMap, Google Maps or Bing Maps and programs that deal with geodata, like GpsPrune, JOSM or Viking.
By default, gpx2svg tries to combine as many track segments as possible to combined paths, so that the output is as usable as possible. If respective content is found, three groups are created: one with all single points, one with all closed paths and one with all open paths.

gpx2svg is written in Python 3 and only uses the standard library without further dependencies. That means you just have to have Python 3 itself installed to be able to use it. Thus, it will most probably not only run on Linux, but also on Windows and Mac.

It's just one single file. No installation or compiling has to be done.


gpx2svg takes the following command line arguments (see also gpx2svg --help or gpx2svg -h):

-i [FILE]
GPX input file (default: read from STDIN)
-o [FILE]
SVG output file (default: write to STDOUT)
Maximum width or height of the SVG output in pixels (default: 3000)
Drop single points (default: draw a circle with 1px diameter)
"Raw" conversion: Create one SVG path per track segment, don't try to combine paths that end with the starting point of another path
Join all segments to a big one in the order of the GPX file. This can create an un-scattered path if the default combining algorithm does not work because there are no matching points across segments (implies -r)

An example call to convert the GPX data in gpxfile.gpx to SVG would be:

gpx2svg -i gpxfile.gpx -o gpxfile.svg

Using the standard input and output, you could for example produce a gzipped SVG file from a gzipped GPX file like so:

zcat gpxfile.gpx.gz | gpx2svg | gzip -f > gpxfile.svgz


Here some screenshots. The first one is a GPX file containing the coastline of Iceland (extract from OpenStreetMap) viewed with GpsPrune. The second one shows the unchanged SVG output of gpx2svg viewed with Inkscape and the third one shows the same data with changed border width and filled with a colour (notice that this was possible without joining any nodes :-). Additionally, the paper size had been increased.

GPX file in GpsPrune Raw gpx2svg output in Inkscape Border width changed and paths filled

Getting involved

The code is managed using Git and can be found on GitLab at https://gitlab.com/l3u/gpx2svg.


Latest Version

10.7 KB, Last Change: 2018-07-23

PGP Signature File:gpx2svg-0.1.5.tar.xz.asc

Older versions

gpx2svg-0.1.4.tar.gz | 11.1 KB | 2015-01-04
gpx2svg-0.1.3.tar.gz | 11.0 KB | 2014-09-05
gpx2svg-0.1.2.tar.gz | 10.6 KB | 2013-11-07
gpx2svg-0.1.1.tar.gz | 10.4 KB | 2012-08-26
gpx2svg-0.1.tar.gz | 9.5 KB | 2012-08-25
nasauber.de © 2005–2020 Tobias Leupold | Impressum | Datenschutz