FizzyMagic's Logo
 

GPX to HTML Converter

 

Contents


News

Current Version: 1.90 12/15/04

The newest version has many changes in the .loc file output, and can now abbreviate some cache names.

See Advanced Options for more details.

Perl: gpx2html.zip (as a .zip file)
Windows .exe: gpx2html.exe

Introduction

gpx2html is an application that generates simplified and compact HTML pages from GPX files obtained from Pocket Queries at geocaching.com. The HTML files can then be exported to a Palm device using Plucker. Here's a sample HTML page from gpx2html.

I have processed the perl script through perl2exe and made a self-contained Windows executable. You can run this without having Perl installed. To fix the problem with command-line arguments, I have made it so that by default it processes all GPX files in the directory in which it is run. Just download gpx2html.exe, place it together with the GPX files you want processed in a folder, and run it.

If you have Perl, once you download gpx2html.zip running, you will also have gpx2csv.pl, a companion script that generates g7towin-compatible CSV files and DeLorme Street Atlas USA-compatible TXT files. g7towin is an excellent freeware waypoint-management tool, and I strongly recommend it, especially over EasyGPS. I plan to make an executable version of this available, too, but there are a few technical issues I am dealing with.

Installation

If you don't have Perl

Installation is simple. Just download gpx2html.exe, and put it in a folder where you will place your gpx files. Also go get Plucker, and install it.

Now proceed directly to Using gpx2html.

If you do have Perl

First, get gpx2html.zip, which contains the Perl script.

To install gpx2html, you need to have Perl 5.6.1 installed on your computer. For Windows, get the free version from ActiveState, located here. For newer versions of Windows, use the MSI installation; for older versions, you'll have to download the package. Don't use version 5.8; apparently there are some incompatibilities. Make sure that you add the Perl directory to the path and make a file association for Perl (both are the defaults in the installation process).

Once you've installed Perl, you need to add one file to Perl's local library. Download Twig.pm and place it in the Perl\site\lib\XML folder, where the Perl folder is wherever the ActiveState Perl is installed. So, for example, if ActiveState installs Perl to D:\Perl, you would place the file in D:\Perl\site\lib\XML.

Now make a folder for holding your GPX files, if you don't already have one you use for that. Into that folder, copy any GPX files you've got lying around, or you can use this one for testing. Also copy the gpx2html.pl script into that folder. Create a sub-folder in this folder named HTML.

Now, for Windows users, you have to create a shortcut to the command prompt in that folder. It's not as bad as it sounds.

For Windows 2000 and Windows XP:

Go to the folder in Windows Explorer, and right-click in the blank area. Choose New->Shortcut and type in cmd.exe as the location of the item, and "Command Window" as the name of the item. A shortcut will appear in the folder. Right-click your mouse on the shortcut, and choose Properties. Change the Start In: value to the folder name you are in. So, for example, if your folder is D:\Geocaching\GPX, you would make the the value for Start In. Then click OK.

For Windows 95, 98, and Me:

It's pretty similar, except that I think that you use COMMAND.COM instead of cmd.exe. Everything else should be the same.

Using gpx2html (Perl version)

To run the script, first move any GPX files you want to process into the same folder as gpx2html. Then simply open the new shortcut you've made. You should get a command-line window. Type in:

perl gpx2html.pl

to parse test.gpx. The script will parse through the GPX file and generate a bunch of HTML files in the HTML folder. You can get to them all by opening index.html.

Using gpx2html (EXE version)

To run the app, first move any GPX files you want to process into the same folder as gpx2html. Then just double-click on the gpx2html icon from Windows Explorer. The application will automatically find the GPX files and process them, generating the HTML pages and placing them in a subfolder named (you guessed it!) HTML. You can view them by opening index.html in the HTML folder..

Transferring to Palm

To transfer the HTML to the Palm, use Plucker. Create a new channel that starts with index.html in your HTML folder, and set options to go 3 levels deep. Require that all pages come from the same server, to prevent sucking in external pages. I also recommend having the output go to a console window, as the program seems to run faster that way.

Transferring to GPS

gpx2html now writes out a .loc file named Caches.loc containing all the caches you have processed, for use with EasyGPS or ExpertGPS. This .loc file is different from the one you would get directly from geocaching.com in a few important ways:

  • The cache names have been made much nicer and shorter.
  • No letters are dropped from the cache name.
  • The cache names are converted to uppercase for easy reading on a small display.
  • Ignored caches are not included, and corrected cache coordinates are the same as in the HTML generated.
  • All the caches from your queries are included in one file.
  • The .loc file is much smaller than the gpx files.
  • Long names from cache series can be abbreviated.

To transfer some or all of the waypoints to your GPS, open Caches.loc with EasyGPS or ExpertGPS and upload them to the GPS.

Advanced Options

gpx2html has several advanced options that you may want to use.

Only process a single gpx file

To only process one gpx file, you'll need to use command-line arguments. you can do this either by running the script from a command window or by making a shortcut with the command-line arguments in it.

Just run the application with the names of the GPX files to process on the command line, like this:

gpx2html 1715.gpx

Only the gpx files on the command line will be processed.

Include notes

You can attach your own notes to cache pages using the excellent Watcher program written by Clayjar. gpx2html now attaches the notes to the end of the cache description. To include the notes, simply copy Watcher's Notes.xml file to the folder containing the gpx files that you will be processing. The notes will be automatically detected and added to the cache descriptions.

Ignore caches

You can keep a list of caches to ignore. Just make a file named IgnoreCaches.txt in the folder with the gpx files. In this file, place the IDs of the caches to ignore, one on each line. Here's a sample file:

# Cache IDs to ignore
GCBBA9  # Double Trouble
GC9C71  # Like an Extra Virgin
# GC7C43  # This one WON'T be ignored!

Lines that begin with a hash (#) are comments and will not be used. Likewise, anything after the # in a line will also not be used. It's a convenient place to keep the cache name so you can remember it, but not required.

If you want to stop ignoring a cache, either delete it from the file or place a # in front of it to disable it from being ignored.

Correct cache coordinates

You can maintain a list of corrected coordinates for caches. This feature is useful for several scenarios:

  • You've solved a puzzle cache but haven't yet gone to it.
  • The cache is a moving cache but the coordinates on the cache page aren't updated when it moves.
  • Cache finders have reported corrected coordinates but the cache owner hasn't updated them yet.
  • You are part-way through a multicache and want to keep the coordinates of the next stage.

To make the corrected coordinates, just make a file named CorrectedCaches.txt in the folder with the gpx files. Each line of this file is the cache ID with the corrected coordinates. Here's a sample file:

# Enter cache IDs to correct
# CacheID, Lat, Long
GC9B94, 37.62765, -121.039233 # Margarita's Coding Cache
GCB6CC, N 37 36.588, W 120 56.231 # CVC Tag!!

As with the ignore list, any lines starting with # are nor used, and you can use the # to place comments on each line to disable corrections for any cache.

You can enter the coordinates as either decimal degrees or in decimal minutes format (like geocaching.com does). See the example above.

List caches by distance from reference points

You can generate index pages of caches sorted by distance from reference points that you choose. For example, you can sort the caches by distance from home as well as distance from work. To generate the pages, just create a file named RefLocations.txt in the folder with the gpx files. Each line of this file is the reference location's name, its coordinates, and a maximum distance to list the caches. The default distance is 100 miles. Here's a sample file:

# Enter reference locations
# Name, Lat, Long, Distance
San Jose, 37.3323667, -121.9277667, 100 # Within 100 mi of San Jose
Modesto, N 37 38.33, W 120 59.75, 10 # Within 10 mi of Modesto
Berkeley, N 37 52.110, W 122 16.446, 5 # Within 5 mi of Berkeley

As with the ignore list and corrected coordinates, any lines starting with # are nor used, and you can use the # to place comments on each line to disable the reference point.

You can enter the coordinates as either decimal degrees or in decimal minutes format (like geocaching.com does). See the example above.

Abbreviate cache names for GPS use

Sometimes a cacher will hide a series of caches with long names that are almost exactly the same. For example, my friends Team Jiffy hid a series of caches in my area named the Northern CA Solar System Model. Unfortunately, when the caches were loaded into my GPS, the comment field would only show the first 32 characters of the name, so I couldn't easily tell which was which as I searched for the nearest caches in my GPS. So gpx2html lets you change the long, repetitive text into an abbreviation, using a file named CacheNameChanges.txt. The file format looks like this:

# Cache Name changes
# Original Name, New Name
Northern CA Solar System Model,NCSSM
Bay Area Multiple Hills,BAMH
Secret Trailhead,SecTrlH
Each time the first string is encountered in a cache name, it is changed to the second. This only happens for the cache names in Caches.loc, not for the cache names in the HTML files.