Part 3

Geocaching and Route Planning - Part 3

Note: A GPSBabelGUI version of these are instructions are available here: Geocaching and Route Planning - Part 3 (GUI Method)

Previously on Geocaching and Route Planning (Part 1), we planned a geocaching trip from Austin to San Antonio, Texas. We wanted to hit all caches that was only 2 miles from I-35. In Geocaching and Route Planning (Part 2), we showed how to build the ARC filter file with MapSend or Mapsource.

In this edition of Geocaching and Route Planning, we will show how to build the ARC filter file using Google Maps.

Note: GPSBabel version 1.2.8 (beta) or later is needed for this procedure.

The first task is to go to Google Maps and select "Get directions".


Route 3-1 Picture

Once there, we enter our starting and ending address. In this case we're using "Austin, TX" for starting and "San Antonio, TX" for ending addresses. Select "Search" when done.


Route 3-2 Picture

At this time we need to know the URL but Google Maps doesn't show it. However, there is a link to show the URL in the address field. Select "Link to this page" to show it.

Route 3-3 Picture

We need to copy the URL to the clipboard or, better yet, a text file.


Route 3-4 Picture

Once we have the URL, we can use wget to retrieve the data. wget is command line utility to retrieve web pages.

Note as of 12-15-2005: The version of wget for windows above does not appear to pass the &output=js parm on to Google Maps. See the alternate procedure below. Linux and OSX users should not be effected.

Before we run wget, we need to modify the URL and add "&output=js" to the end. Here is a example:

http://maps.google.com/maps?
q=from%3A+Austin,+TX+to%3A+San+Antonio,+TX
&f=d
&hl=en
&output=js

Note: I have broken the URL down for easy reading. It should be entered all on one line.

Execute the following wget command on the command line. The output will be sent to the file called "googleroute.txt". Also make sure the URL is enclosed with double quotes.

wget -O googleroute.txt "http://maps.google.com/maps?
q=from%3A+Austin,+TX+to%3A+San+Antonio,+TX
&f=d
&hl=en
&output=js"

Note: I have broken the command down for easy reading. It should be entered all on one line.

Now that we have the google route file, let's build the ARC filter file:

gpsbabel -i google -f googleroute.txt -o arc -F googleroute.arc

We can then input the ARC filter file into the command as in Part 1:

gpsbabel -i gpx -f all.gpx -x arc,file=googleroute.arc,distance=2M -o gpx -F route.gpx

That's all there is to it.

Alternate procedure to (w)get googleroute.txt:

If you get a empty googleroute.arc file then it is possible that your version of wget is not working properly and is acting like the &output=js is not being passed onto Google Maps. Try this:

After you've clicked the link to show the URL, add &output=js to the end of the URL then press enter. You should now have a webpage with a couple of boxes on it. Select File/Save As and save it as googleroute.txt. Make sure and save it as "Webpage, Html Only". Continue on to create the ARC filter file.