[Keine deutsche Version verfügbar]

gpx2svg

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 just uses the standard library without further dependencies. That means you just have to have Python 3 itself installed to be able to use it. It's just one single file. No installation or compiling has to be done.

Usage

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)
-m [PIXELS]
Maximum width or height of the SVG output in pixels (default: 3000)
-d
Drop single points (default: draw a circle with 1px diameter)
-r
"Raw" conversion: Create one SVG path per track segment, don't try to combine paths that end with the starting point of another path

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 like so:

cat gpxfile.gpx | gpx2svg | gzip -f > gpxfile.svgz

Examples

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 current state of the code can be checked out from git://git.l3u.de/gpx2svg.git (see also http://git.l3u.de/?p=gpx2svg.git). Please always patch against git master!

Download

Latest Version

gpx2svg-0.1.4.tar.gz
11.1 KB, Last Change: 2015-01-04

Older versions

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–2017 by Tobias Leupold