GPS to Google Earth: Data Collection Walkthrough
Sometimes you get tired of "armchair mapping" -- working exclusively with digital tools from the comfort of your home or office. Sometimes you want to go ride bikes through the Yosemite Valley, marveling at the waterfalls and cliff faces and rushing rivers. Sometimes your friend Alan gets a new Garmin Oregon 400t handheld GPS unit and you want to go play with it. Sometimes all three of these things happen on the same day PLUS it's your birthday so you can totally feel justified to take the day off to go do it as long as you blog about it later!
Until that trip to Yosemite, I did not have very much experience with GPS equipment. My phones haven't been equipped with GPS until very recently and although I've borrowed a couple of GPS units before from friends and colleagues, I hadn't gotten to really play with one for any useful length of time. The Oregon 400t was very intuitive to use, though - the touchscreen interface makes things a lot easier, of course. The unit comes preloaded with topographical maps of the continental US, I believe, though there are models with marine maps, world maps, and some others.
Into the woods...
Before the day of our ride, we used the Oregon on some hiking trails in Yosemite as well as some (legal) offroad 4x4 trails throughout Tahoe National Forest. During the offroading (Alan was driving; I was navigating), I compared the track and topo lines on the GPS unit with some printed USGS topo maps that Alan had for the area. As you might expect, the Garmin was great for getting our bearings and estimating the grades of various offroad trails, but for "big-picture" planning, nothing can beat being able to spread a USGS map out on your lap or the hood of the truck. Depending on the terrain and our speed, the size of the Garmin screen meant that we could never really "see" what was more than 1/4 mile to 2 miles out without a lot of awkward scrolling, which is kind of a pain when you're dropping 2 vertical feet down a gully and your head is smashing into the ceiling of the truck.
So on May 13th, we rented bikes from Yosemite's Curry Village Bike Rental shed and set out. Alan set the GPS to begin recording a new track, we loaded our backpacks with water and granola bars, and we were off!
After some of the hiking in Yosemite we'd done previously in the week, I was a bit worried about how much elevation we'd be climbing on the ride: all of my previous cycling has been in the nice, flat Midwest... but it turns out the trails go through the valley and none of the hills/grades we encountered would have been out of place in Chicago. The elevation data we recorded wasn't too helpful on this particular day, however, since we'd had some trouble properly calibrating the barometric pressure-based altimeter. The GPS was collecting waypoints on a periodic basis (which I neglected to note the frequency of :) so you can see that some of the portions were downhill (waypoints added infrequently) vs. the steeper uphill climbs or crowded bike path traffic jams (closer clusters of waypoints). There are also some really thick clusters which probably represent water/food/bathroom breaks where we forgot to turn off the GPS.
Viewing GPS Data With Viking
A few days later, after we had to leave the beauty of Yosemite and go back to the real world, I plugged the Garmin into my laptop to see what sort of data we collected and what open source tools exist to view and manage that data. I'm sure there are tools from device manufacturers to upload and view this stuff, but I'm using Linux and I only wanted to use open source software if possible.
Plugging the unit's USB cable into my Ubuntu laptop, I was pleased to see that I could easily navigate the device's memory. I found a folder that stored all of the saved GPS tracks we had recorded during the week, handily named with date/time-stamps. I copied the bike trip file to my laptop, and named it bike.gpx. (GPX is a common format for recording and sharing GPS tracks and waypoints - wiki link.)
The first program I used was Viking, which is an open source graphical GPS data manager available for Linux and Windows. I opened the bike.gpx file in Viking and immediately saw a clearly-visible path of Yosemite Valley traced out by GPS trackpoints during our expedition, accounting for the twists and loops of our sightseeing bicycle path.
Viking allows you to edit individual waypoints and trackpoints, calculate bearings and distances between points, and several other cool features. One of the neatest features is the layering capability: you can superimpose various layers on top of one another, including GPS tracks and waypoints, imagery, and web map server data such as Google or OpenStreetMap. I actually never got the Google layers working but you can see the OpenStreetMap layers and TerraServer Topography layers with our track superimposed over the top (kind of hard to see on the Topos). You can also export the data, such as saving a static image of your map (though I've used ksnapshots here for the purpose of illustrating the Viking interface).
Converting GPX to KML Using gpsbabel
After playing with Viking I wanted to try to import my data into Google Maps / Google Earth. Google, of course, uses the KML format (wiki link about Keyhole Markup Language, another format for exchanging geographic data) so I needed to convert my GPX file to a KML file. Enter gpsbabel! Gpsbabel is an open source utility for converting files between geographic formats. The command I used for this particular case was:
gpsbabel -i gpx -f BIKE.gpx -o kml -F bike.kml
Broken down, that means "execute gpsbabel, input file is gpx format, named BIKE.gpx. The output file should be kml format, named bike.kml." (All of that, including flags and filenames, is case sensitive, by the way!) Voila, I now had a KML file suitable for import into Google Maps or Google Earth (or one of the dozens of other desktop and web apps that work with KML files :) I was kind of surprised how much bigger the KML was: about a 10x increase in size from the GPX to the KML. I'll have to tinker with the command line options and learn more about the KML spec to see exactly what it's doing behind the curtain.
Uploading to Google Maps
I then logged into My Maps on Google, created a new map, and selected the import option. Google lets you import GeoRSS, KML, or KMZ files of up to 10MB in size, so I thought I was ready to go. However, I learned that My Maps only shows you 200 features (in this case, my trackpoints) at a time for paging/performance reasons. So to see the whole route, you have to page through like 10 screens. I am sure I could tweak the data in Viking but for our first attempt, I thought this was pretty cool.
Checking it out in Google Earth
Google Earth is Google's free 3D desktop mapping application - most people don't have it installed so it doesn't have the widespread accessibility of Google Maps. However, Google Earth (and its $400 "professional version" big sibling, Google Earth Pro) is a wonderful tool for creating all sorts of powerful graphics, videos, and interactive tools for viewing and working with mapping data. Displaying a track of our bike path in Google Earth is using about 1% of the program's capabilities, but for the purposes of experimenting with data portability, these screenshots should illustrate enough. I'm very impressed with the accuracy - seeing how many waypoints are directly on the bike path on the satellite imagery.
OK, so this wasn't really an "experiment" in the official sense of the word, but this was a pretty cool and informative tour of some various GPS tools.
- Conclusion 1: riding bikes through Yosemite on a beautiful spring day while "collecting data" was pretty awesome. We should totally do more fieldwork, especially while the weather is nice :)
- Conclusion 2: for our first attempt, and considering the limited amount of time we spent with the actual data tools, I was pleasantly surprised by how easy it was to move data from the field into several useful formats and presentations. I want to find a potential use case for collecting data in addition to GPS coords (descriptions, multimedia, etc.) and dumping it all into a GeoCMS for a more polished final presentation. I also want to play with my smartphone's ability to automagically tag each photo I take with the geolocation of where I took it - automating the upload of that data to a website would make a pretty sweet documentary tool.