Add to Technorati Favorites .................................. - GPS Hacks
..................................
the blog@spencerwilliams.net

Innards of KML files - gross (seriously)

January 13, 2008 12:27 by Spencer

Compared with GPX files, KML files are ugly - at least when they are saved by Google Earth.

Look at this file:  GPX File

and compare it to this:  KML File

The KML file is XML, but when it comes to coordinates it just craps them out in one HUGE coordinates tag.  Take a close look,

-97.82383400000001,30.275435,267.383911

The 3rd number in the comma-delimited string (I thought that went away with XML?) is the elevation.  Not very pretty.  Compared with the GPX format:

- <trkpt lat="30.266583" lon="-97.823150">
  <ele>182.691</ele>
  <time>2007-12-20T21:46:55Z</time>
</trkpt>
Very pretty.  Unfortunately the schema of GPX files doesn't lend itself to doing much more than recording tracks and waypoints.  It's a file format made for GPS units only.  So instead of crafting a more difficult regExpression to remove the elevation data out of the KML file, I just regEx(^ *<ele>.*<\/ele>) to remove the elevation data from the GPX file before editing it in Google Earth and saving it as a KML file.

GPS Tracks - editing/manipulation

January 10, 2008 08:15 by Spencer

I love looking at where I've been.  I love not having to recreate where I've been on a map after I have traveled.  If only there was a way to record where I've been, and then somehow be able to put that on a map that people could see......I recently bought a GPS, and whaddya know, it can do that! 

Now comes the fun part, showing a trail map that is "exact" or as exact as my Garmin eTrex Vista HCx can gather from civilian satellites on a map - online - for the world to see (or at least my friends).  GPX files are the export format of choice for GPS receivers.  You can view the schema of GPX files here, the documentation for that schema here and a general overview here and here

I usually get home from a bike ride or a hike/geocaching expedition and grab the file off of my GPS.  Now, because the GPS has to be on when I retrieve the files and waypoints (I guess I could pull the card out, but that's a bit more time consuming considering my bike mount), the track file normally gets updated with some more information than I would like - the location of my house.  Normally, when I load the GPX file into Google Earth, I see a nice trail track of where I was, and then a long line drawn from the parking lot or ending point, to my house.  The GPS takes the last point it had when it was on - the parking lot, and adds to it the next point it gets when I turn it on in my house - usually a few miles away at the least.  I understand that I could tell it to stop recording the tracks when I'm done hiking/biking/etc, but I forget.

Either way, the file needs to be edited in a easy-to-use program like Google Earth so that I can add names that are more than a few characters to waypoints, add descriptions, choose better icons to mark my places, etc.  I usually edit the track XML in a text editor using the time element as a guide, and then import the GPX into Google Earth.


Tags:
Categories: Geocaching | GPS Hacks
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed
 
Blog Information Profile for williasp