Archive for the ‘GPS’ Category

GPS Tracks

September 18, 2007

joseph.pngWalking and recording the route using a hand-held GPS device and then mapping the route is now kind of a hobby of mine. Yesterday I went for a walk to St. Joseph Hilltop trail (elevation increase of 800 feet) and used my Garmin device that has far too many buttons and menus to make a an easy to use tool to record my route.

Maps on iPhone: Bike route from Los Gatos to San Jose (part 2)

September 14, 2007

bike2.pngI’ve overlaid two bike routes from Los Gatos to San Jose. I noticed that the maps look fine in Firefox but on iPhone you cannot really zoom in as easily as you can in the desktop browser. This is one reason why Google is a special application on the iPhone and not just a web page in the browser. iPhone finger interface works a lot better on the Google iPhone app than it does on the Google browser map. Unfortunately you cannot enter a URL in the Google Maps application, you need to search for an address. It is not clear if it is possible for users to display their mash ups in Google iPhone Maps application or not. Does any one know?

note19 project

July 11, 2007

Note 19Today I created a Google project to place scripts that I create whilst learning about maps, gpx, … under source control. These scripts are of little use to anyone else (unless you too are a newbie to ruby, gpx and maps). I’m also new to subversion. I’ve used it to get the sources of a number of apache project, but have never used it to check in code. It took a number of iterations to get my environment set up for subversion:

  1. Create google project
  2. Create a root folder where you plan to store your sources, e.g., ~/myproject
  3. Create 3 subfolders under ~/myproject: ./branches, ./tags, and ./trunk
  4. cd ~/myproject/trunk
  5. Check out the empty subversion project from google. This will set the subversion environment for the ~/myproject/trunk folder:
    svn checkout .
    --username your-id --password your-password
  6. Start copying your actual sources to ~/myproject/trunk folder and then use the svn add command to add the content of this folder to subversion: svn add .
  7. Now set your editor via the SVN_EDITOR environment variable, e.g.
    export SVN_EDITOR=emacs
  8. Use svn commit to check in your sources.

I created a small Ruby module to read GPX files and convert them to Google maps. Here is the latest data from my GPS device. The data needs to be filtered, some of the GPX tracks have 500 points and they are so close together and one could safely eliminate a large percentage of them and still have an accurate rendition of the route. But some, like track #8, cover a long range.

GPX bounds element

June 16, 2007

The GPX file has a very convenient element called bounds which defines the bounding box of all of the tracks defined in the GPX file. Here is a sample:

<gpx ...>

This elements allows you to quickly find where to center your map and also allows you to draw a bounding box around track. Without this element you would need to find the min. and the max lat. and long. of all the track points in the GPX file.

Here is a JavaScript function to create a bounding box (using Google Map API) around the track (the $ notation (Perl) means the value of these variables on the server where you’re creating the JavaScript):

function createBoundingBox() {
       var box= [];
       box.push(new GPoint($minlon, $maxlat));
       box.push(new GPoint($maxlon, $maxlat));
       box.push(new GPoint($maxlon, $minlat));
       box.push(new GPoint($minlon, $minlat));
       box.push(new GPoint($minlon, $maxlat));
       map.addOverlay(new GPolyline(box));

Google API also includes class GBounds that allows you to create a bounding box object and has methods to find the intersection of two bounding boxes, if a point is included in a bounding box, etc. You can create a GBounds object using the GPX bounds elements, e.g.,

var bounds = new GBounds($minlon, $minlat, $maxlon, $maxlat);

Tracks in GPX 1.0

June 10, 2007

GPX 1.1 format was released in 2004. My recently purchased Garmin device and GPSBabel only seem to support GPX 1.0. I’m not sure if any application currently supports 1.1 or not. I started looking at the GPX files that my Garmin device produces. I don’t bother with Way Points or Routes. I’ve set the device to records Tracks, i.e. as soon as I turn on the device, it starts recording. Here is the outline of a GPX 1.0 file format (the schema describes the format in more details):

<gpx ...>
  <bounds minlat="..." minlon="..." maxlat="..." maxlon="..."/>
      <trkpt lon="..." lat="...">
  1. bounds. Is the bounding box (in terms of min. max. latitude & longitude) for all of the paths in this GPX element. The latitude & longitude are given in decimal degrees (-90…+90 & -180…+180, respectively)
  2. trk. A Track is a sequence of points describing a path. Each track is assigned a number by the device. Numbering starts from 1. A track can contain zero or more track segments. But with Garmin, each track contains at most one track segment.
  3. trkseg. A Track Segment holds a sequence of Track Points (trkpt). You can configure  how frequently your device records a track point. I’ve set mine to auto which appears to mean random. With my Garmin device each track point includes the elevation & optionally the time. I’ve not figured out why some track points don’t have the time. The GPS device starts a new Track Segment for each continuous span of track data. For instance, when the GPS reception is lost, the current Track Segment is ended, and when reception is re-established, a new Track Segment is created. With my device, a new track and thus a new track segment is created. This means that by looking at the time each track ended and the new one created, you could find out the places where the reception was lost.

Useful Google Map Sites

May 31, 2007

I’ve come across a number of interesting sites that allow you to create a route and display it on Google maps.

  • WalkJogRun allows you create a site by clicking on a map. You can share the route, search for a route and download a GPX representation of the route.
  • TierraWiki lets you directly import a GPX file and add associated details such as photos.
  • Gmaps Pedometer is supposed to be similar to WalkJogRun, but I couldn’t get it to work.
  • Click-to-route allows you to click on a map to create a track.

A few sites offer scavenger hunt: Waymarking, Geo Caching & then there is Garmin’s MotionBased site for runners.

May 28, 2007

The Where 2.0 conference is worth following. I couldn’t find an RSS feed for this conference but someone from Google Earth said that they will be attending & blogging about it. The list of conference sponsors is a who-is-who of location based systems and services.

Directly Google map GPX files

May 27, 2007

Sample Map of a GPX fileI’m not sure if either Google or Yahoo maps API directly accepts the gpx file format or not. My brief search of their documentations suggests that they don’t. You need to convert the gpx file that you get from your GPS device to KML or GeoRSS or … before you can use it. I wrote a simple utility to directly map my GPX files. Here is a sample.

Point by point or whole route

May 27, 2007

There are essentially two way of creating a route overlay on a Google map. One is to convert each track point to a Google map point (using client JavaScript) and the other is to pass the entire track to the GGeoXml constructor. Here is the point-by-point example (the gpx file format was converted to Google HTML map page), and this is the whole route example (I used GPSBabel to download the track in KML format). Initially I thought that the point-by-point was slower, but after a number of runs I’m not sure. The performance of Google maps (Javascript) on OS X Firefox is unpredictable. In the case of the whole route, I pass the KML version of the route to the GGeoXml function. The information on the points of interest, e.g., latitude, longitudes, … are there but are lost when Google renders the route.


May 26, 2007

GeoRSS stands for Geographically Encoded Objects (and we all know what RSS stands for). It could become the standard format for describing routes, trips, and so on. It comes in two flavors: Simple and GML (Geography Markup Language). Both Yahoo and Google now offer GeoRSS support (Google GGeoXml class can dynamically handle both KML (KML is Google Earth’s file format for modelling and storing geographic data) and GeoRSS file formats). Here is an example using Google maps. In this example, I created a track and transfered it as a KML file and then referenced it in a HTML page that creates a Google map and initialize it using this KML file.


Get every new post delivered to your Inbox.