A weirdly named site with lots of boring content!

Sun 21 Dec 2008
11:28AM
compton

Convert GPX to OpenGIS KML Encoding Standard (OGC KML)

There are a myriad of XML formats for encoding GPS data. Google has a preference for Keyhole Markup Language (KML) and its zipped form, KMZ. gpsbabel, an open source tool for interacting with GPS devices that is compatible with Linux, Windows and Mac OS-X, has GPX (GPS eXchange Format, an XML schema designed for the transfer of GPS data between software applications) as its preferred format.

As these are both XML formats, it should be possible to write XSL stylesheets to transform one to the other. These stylesheets would allow you to both design training routes on Google Maps, and also view recorded training rides on Google's online mapping tool.

GPX is fairly simple. Here's a sample file:

<gpx version="1.0">
   <time>2008-12-20T18:06:08Z</time>
   <bounds minlat="52.446012469" minlon="-2.031685989" maxlat="52.482436448" maxlon="-1.880240338"/>
   <trk>
      <name>0</name>
      <trkseg>
         <trkpt lat="52.446626695" lon="-1.880240338">
            <ele>153.948364</ele>
            <time>2008-12-15T15:55:56Z</time>
         </trkpt>
         <trkpt lat="52.446738677" lon="-1.880564885">
            <ele>155.390259</ele>
            <time>2008-12-15T15:56:02Z</time>
         </trkpt>
         <trkpt lat="52.446766421" lon="-1.880636131">
            <ele>155.390259</ele>
            <time>2008-12-15T15:56:03Z</time>
         </trkpt>
         <trkpt lat="52.446921738" lon="-1.881017424">
            <ele>157.312866</ele>
            <time>2008-12-15T15:56:08Z</time>
         </trkpt>
         <trkpt lat="52.446957277" lon="-1.881097052">
            <ele>157.312866</ele>
            <time>2008-12-15T15:56:09Z</time>
         </trkpt>
      </trkseg>
   </trk>
</gpx>


KML is altogether more sophisticated. It can encapsulate all the information that can be viewed on Google's rather verdant maps interface.
 
Leave Comment

/xkcd/ Physics Confession