A weirdly named site with lots of boring content!

Sun 21 Dec 2008

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">
   <bounds minlat="52.446012469" minlon="-2.031685989" maxlat="52.482436448" maxlon="-1.880240338"/>
         <trkpt lat="52.446626695" lon="-1.880240338">
         <trkpt lat="52.446738677" lon="-1.880564885">
         <trkpt lat="52.446766421" lon="-1.880636131">
         <trkpt lat="52.446921738" lon="-1.881017424">
         <trkpt lat="52.446957277" lon="-1.881097052">

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/ Memorable Quotes