Monday, August 25, 2014

Fun and Games with Google Maps and GPX Files, Revisited

Introduction


Four years ago I posted an article on a helpful trick for display GPS tracks directly in Google Maps. There have been a few changes in this area, so it seemed worth the time to revisit.

tl;dr for the impatient

  • In Google Maps Classic, enter the URL of a publicly-accessible GPX or KML file into the edit field normally used for search terms. When you click the search button (or press enter), the track[s] appear on the map. 
  •  A Ride With GPS route (of the form http://ridewithgps.com/routes/NNN) can be directly retrieved as a GPX stream by simply appending ".gpx" to the URL.

Details for everyone else


Before diving into the details, two prerequisites must be covered.

Google Maps Classic


It appears that this trick works well with Google Maps "Classic", but not with the recent (2014) UI refresh. To switch Google Maps back to the "Classic" UI, perform the following steps:
  1. Optional: Open an incognito/private window in your browser (only necessary if you want to ensure your changes to the Google Maps settings don't impact your usual browsing.)


  2. Go to Google Maps.


  3. Near the lower right corner, click the small question mark icon. In the resulting popup menu, click "Return to classic Google Maps".


  4. Give any feedback you feel is worthwhile (I always enable the "Missing features" checkbox), then click "Return to classic Google Maps".


  5. Classic Google maps will be enabled, and you'll be prompted to make the change permanent.


  6. Done! It's almost as if the 2014 refresh never happened.


Ride With GPS


Ride With GPS (RWGPS) is an excellent online tool for planning new routes, reviewing existing routes, and uploading/analyzing ride data. It is quickly becoming the de facto standard for storing and sharing bike routes.
Disclaimer: I personally know Zack and Cullen, the creators of this site, so I may be a little biased in my opinion of how much it rocks.
There's a small, somewhat underdocumented feature of RWGPS that's very useful in this context: Given the URL of a stored route (of the form http://ridewithgps.com/routes/NNN) or an uploaded ride (of the form http://ridewithgps.com/trips/NNN), you can easily access it as GPS data or as a Google Earth file by appending ".gpx" or ".kml" to the URL. 

For example, http://ridewithgps.com/routes/3790042 is a route I would like to ride soon. Clicking on the link as-is goes to the expected RWGPS page. Appending ".gpx" to the URL results in http://ridewithgps.com/routes/3790042.gpx, which is a link to the raw GPS data. Likewise, http://ridewithgps.com/routes/3790042.kml is a link to a Google Earth representation of the route.

RESTful design FTW!
Note 1: Google Maps seems to enforce an upper bound on the size of GPX files that it will display. RWGPS routes, even extremely long ones, seem to work fine. Long trips, though, often exceed the upper bound and cannot be displayed.
Note 2: To use a RWGPS URL in the following trick, the route or trip must be marked as public, not private or "friends only".

The Trick


Given the URL of a publicly-accessible GPX or KML file, you can easily display this directly in Google Maps. Simply enter the URL into Google Map's search box, and either press enter or click the search button. In this example, I'll use a route stored in RWGPS, and append ".gpx" to the route's URL.


The track[s] contained in the GPX or KML file will be displayed


This is, in itself, not super useful. After all, you can see more or less the same thing directly in RWGPS. However, Google Maps can display multiple search results simultaneously.

Let's say we're interested in finding coffee along the route. Simply enter "coffee" in the search box and press enter or click the search button.


OK, we see hundreds of coffee shops (this is Seattle, after all) but the track has disappeared. No problem -- click the small box near the upper right corner, the one just below the "Map/Satellite" mode. It will probably say "Traffic" or maybe "Terrain" depending on the area viewed. In the drop down that appears, you'll see the active search terms.


Click on the RWGPS URL and the route will display.


Optional: Click on the "coffee" search term to make it the primary search. The left pane will fill with the top results.


Oh look, The Commons (one of my favorite coffee places) is very near the route. Good to know.


You can easily add more search terms. For example, "bike shop" is a useful search. Woodinville Bicycle (my favorite bike shop) appears here as well.



I find this trick quite useful when planning long routes, or when familiarizing myself with long pre-planned routes. It's always good to know where the coffee shops are along the way.

3 comments:

Michal Young said...

Very useful! Thanks!

Anonymous said...

This is excellent, thanks Keith!

lynnef said...

awesome!