Un Garmin donne la trace GPS suivante : AiguillesRouges.gpx
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<gpx xmlns="http://www.topografix.com/GPX/1/1" creator="MapSource 6.16.3" version="1.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
<metadata>
<link href="http://www.garmin.com">
<text>Garmin International</text>
</link>
<time>2019-07-28T08:08:05Z</time>
<bounds maxlat="46.024869801476598" maxlon="6.926982309669256" minlat="45.935957757756114" minlon="6.771008670330048"/>
</metadata>
<trk>
<name>Tracé actuel: 23 JUIL 2019 07:39</name>
<extensions>
<gpxx:TrackExtension xmlns:gpxx="http://www.garmin.com/xmlschemas/GpxExtensions/v3">
<gpxx:DisplayColor>Black</gpxx:DisplayColor>
</gpxx:TrackExtension>
</extensions>
<trkseg>
<trkpt lat="45.936855375766754" lon="6.771008670330048">
<ele>872.52999999999997</ele>
<time>2019-07-23T05:39:31Z</time>
</trkpt>
<trkpt lat="45.936975907534361" lon="6.77103029564023">
<ele>873.98000000000002</ele>
<time>2019-07-23T05:39:42Z</time>
</trkpt>
...etc...
gpx.xsl, un petit bout de code XSLT
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:gpx="http://www.topografix.com/GPX/1/1">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:for-each select="gpx:gpx/gpx:trk/gpx:trkseg/gpx:trkpt">
<xsl:value-of select="@lon"/>
<xsl:text> </xsl:text>
<xsl:value-of select="@lat"/>
<xsl:text> </xsl:text>
<xsl:value-of select="gpx:ele"/>
<xsl:text>
</xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Et sur Linux,
$ xsltproc gpx.xsl AiguillesRouges.gpx > AigRou.xyz
donne les coordonnées X, Y et Z en 3 colonnes :
6.771008670330048 45.936855375766754 872.52999999999997
6.77103029564023 45.936975907534361 873.98000000000002
6.771165663376451 45.937128961086273 876.38
6.771242022514343 45.937253851443529 877.34000000000003
6.771263061091304 45.93731545843184 877.34000000000003
6.771297678351402 45.937489299103618 879.25999999999999
etc...
Qu'il suffit de traiter avec le script gnuplot suivant :
gnuplot << END
set term png size 1200,900
set grid xtics ytics ztics
set output 'AigRouXYZ.png'
splot "AigRou.xyz" with lines
set output 'AigRouXY.png'
plot "AigRou.xyz" using 1:2 with lines
set output 'AigRouZ.png'
plot "AigRou.xyz" using 3 with lines
END
pour obtenir les graphes suivants :