GEOLOG
Note: The file is not up-to-date. The most recent descriptions
are found in the German file liesmich.html. If you have
questions, contact me at geolog <at> felias-fogg.de. If there is enough
interest, I can be convinced to update the English description as
well.
1. What is it good for?
Geolog
is a Perl script (also available as a Windows program) that you can use to generate
HTML pages from Geocaching information such as Groundspeak's pocket queries in a rather
flexible way by using templates. An example is my Geolog website:
http://felias-fogg.de/. One particular use of Geolog is the generation of statistical summaries such as http://felias-fogg.de/stat.html.
Geolog also assists you in downloading log photos of your logs and in incrementally
updating log and listing information.
Additionally, Geolog prepares the information so that they can be uploaded to the opencaching.de website using
the Ocprop script.
2. File Structure
When starting the program the first time, one has to specify the
directory where all the cache data is going to be stored. We call this
directory the main directory in what follows. By default, the
main directory will have the name gcdir. After the directory
has been fixed, Geolog copies a number of files and
sub-diretories into the main directory:
- geolog.css (central CSS file that influences the
appearance of HTMl pages)
- geolog-green.css (alternative CSS file)
- geolog-khaki.css (another alternative CSS file)
- abbrev.txt (file with abbreviations for German HTMl pages,
see Section 7)
- abbrev-en.txt (English abbreviation file, must be renamed
to abbrev.txt)
- translate.txt (German translations for attributes and values.
see Section 7)
- translate-en.txt (English translations, must be renamed to
translate.txt)
- index.tmpl (template file for HTML file)
- found (directory containing logs for found caches, see Section 5)
- index.tmpl (template file, which is used to generate the
summary page for found logs)
- entry.tmpl (template file, which is used to generate one
found-log entry)
- not-found (directory containing all DNF logs, see Section 5)
- index.tmpl (template file, which is used to generate the
summary page of DNF logs)
- entry.tmpl (template file, which is used to generate one
DNF log entry)
- found (directory containing all hidden caches, see Section 5)
- index.tmpl (template file, which is used to generate the
summary page hidden caches)
- entry.tmpl (template file, which is used to generate a
short description for a cache)
- text.tmpl (template file, which is used to generate a
long description for a cache)
- pics (directory with GIF and JPEG pictures)
- oc_small.gif (OC Logo)
- gc_small.gif (GC Logo)
- ...
3. Installation
3.1 Perl
If you use the Windows executable, installation reduces to unzipping
the file geolog.zip.
If you want to use the script, you need of course Perl. All
decent Linux/Unix distributions contain it already. For Windows, you
have to download and install it first. However, this is quite
painless. Just download and install ActiveState's
ActivePerl. After the installation, all files ending with .pl
will be considered as Perl scripts. You can start them just by
clicking them. If you want to pass options and/or parameters to the
script, you have to start the script in a command window.
It may happen that you encounter error messages such as
Can't locate HTTP/Cookies.pm in @INC ...
when you start the script. This message indicates that a module is
missing, in this case HTTP::Cookies. You can use the module CPAN under
Unix-Perl or the program ppm for ActivePerl under Windows in
order to download missing modules. More information can be found on
the respective websites www.cpan.org resp. ActiveState.
3.2 Setup with the first call
Now one should start Geolog once in order to initialize
everything. This is best done by opening a terminal window and change
into the directory where the main directory is located (or
shall be generated).
When first calling Geolog, you have to specify a number of
parameters, which are then stored in the profile
~/.geolog/profile.txt or, if running under Windows, in
...Application Data\Geolog\profile.txt or something similar.
Later, you can edit this file with a text editor. Instead, it is also
possible to use the -e option when calling Geolog. In
this case, you can go through all the questions again with default
values determined by your previous answers.
4. Calling the Program
If you call the program without any options and parameters, under Windows the user is peresented an option menu. Under Unix, no option is equivalent to calling Geolog withthe option -i.
The general way to call the script is:
geolog.pl [options] [waypoint names]
If one calls the Windows program, one has to use the exe file
extension, of course:
geolog.exe [options] [waypoint names]
With
geolog.pl -h
you get a short help message.
In addition, you can start the program with the following options to
get a special behavior:
- geolog.pl -v: You just get the version information.
- geolog.pl -x GPXfile reads data from a GPX.
Has the GPX file be generated by the My Finds
PocketQuery, then all "found" and DNF logs are copied. Otherwise, the
cache entries are interpreted as "hidden" caches, as long as the "-n"
option has not been given.
- geolog.pl -n waypoint names: The caches identified
by waypoint names will be considered as caches that have not
been found. This is necessary if the script cannot login to the GC
website or when you want to download caches that have not been
reported to not been found. Furthermore, if not found caches have been
logged non-chronological, you either have to specify them manually
using the -n option or you have to specify -a in order to consider all
caches. If one wants to extract data from GPX files (with the -x
option), then the specification of -n will lead to the interpretation
of all caches in the GPX files as not found.
- geolog.pl -r waypoint names: Download all
specified caches (again). This can be useful if you have changed
something or if you have logged a cache non-chronologically.
Instead of specifying waypoint names, one can
also write ll (only location less caches!), all, found, not-found, or
hidden. This can be useful if many descriptions or logs have
been changed or after correcting an error in the program.
- geolog.pl -g: Just generate HTML pages. Do not search on
the GC website.
In addition, there are the following modifiers:
- -e starts the setup dialog again, whereby the default
values are the ones specified in the last setup dialog. In the end,
one is asked whether the template files shall be re-installed.
- -m set the User-Agent in the header to
Mozilla/5.0 .... Otherwise Geolog is used as the User-Agent.
- -p means that one want to access the Internet without
going through a proxy.
- With -b, geolog is started in batch mode, i.e.,
the text editor is not started.
- With -q, geolog is run in the quiet mode, i.e., no status messages
will be output.
- -w means that the
sleep/request/received in form of .[] are suppressed.
- -f forces the regeneration of all HTML pages.
- -m means that the program should pretend to be a
Mozilla browser. If this option is not given, the program identifies
itself as the Geolog user agent.
- -l logfile leads to the generation of a log
file. This helps in debugging.
- If -a is specified, geolog searches through the
list of all user caches and does not stop once a known cache is
found. This can be necessary when a cache has been entered at the GC
website with a log or hidden date that is before the date of an already
registered caches.
- -s results in recomputing the find statistics of your
own caches.
5. Cache Information
If geolog finds a new cache (owned, found or not found) on the
GC website, a new directory with name
Cachename_Waypointname is created. In order to simplify things,
critical characters such as ':', '/' etc. are replaced by '_'. In this
irectory, the following files will be generated:
- cache.txt contains all essential data about the cache:
Name: cache name
GCid: waypoint name
Owner: cache owner
Coordinates: WGS84 coordinates
Type: type, e.g. 'Traditional Cache'
Container: container type, e.g. 'Micro'
Difficulty: difficulty
Terrain: Terrain judgement
Hidden: date when cache has been hidden
Country: country where cache is hidden
Attributes: attributes that are given by icons
Status: status of cache, i.e., ok, disabled, archived
- note.txt contains mainly information about how the cache
has been found (or not been found):
Found: date - entered by geolog
AuxSort: string (e.g., 01, 02, ...) used for sorting caches found or
hidden on same date - entered by user
NotFound: date - entered by geolog or user
LaterFound: date - entered by geolog
Elevation: meter (or feet) - entered by user
Up: how high you had to walk or ride - entered by user
Category: cache category - entered and defined by user
AltCategory1: secondary cache category
AltCategory2: further secondary category
Access: how cache had been access (there are icons in the pics
dir: bike.gif, hike.gif, car.gif, bus.gif, couch.gif)
Search: How many minutes you searched at the final location - entered by user
OverallTime: Overall time in hours - entered by user
Judgement: personal judgement - entered by user
Reason: Reason, why cache has not been found (there are icons in
the pics dir: blind.gif, gone.gif, danger.gif, noaccess.gif, wrong.gif)
Optional1: an optional field
Optional2: another optional field
Optional3: third optional field
NCId: you can specify the NC id as well - entered by user
OCId: OC identifier of cache if it is listed there - entered by
user or script
- log.txt contains the log text
- short.txt contains a short description of the cache, if
the cache has been hidden by the user
- long.txt contains the long cache description
- hints.txt contains the hints
- stat.txt contains info about the find statistics
- gpxentry.txt contains the part of the GPX file that is
relevant for the cache description in order to avoid useless
re-generation of cache and log descriptions
- pics is the directory containing the pictures relevant for
the cache or log
- pics/caption.txt contains the captions, the GC.com URLs
and the filenames for each picture.
The user can generate the following files:
- comment.txt for additional comments
- image.jpg, which should be a characteristic picture
6. Template Files
In order to modify the appearance of the HTML pages, one can edit the
template files. The main directory gcdir contains
index.tmpl. It is possible to add more template files with a
.tmpl extension. All of them will be translated into
.html files, whereby the rules described in the following
section are applied.
Each of the
sub-directories
found,
not-found, and hidden contains the following templates:
- index.tmpl - from this template the table for the
corresponding category is generated;
- entry.tmpl - from this template, the index.html for
each cache is generated;
Additionally, one can generate alternative tables (perhaps with a
different order). The templates for these tables have names
index0.tmpl up to index9.tmpl. The corresponding
HTML file have html file extensions. An additional template for each
cache is the text.tmpl file. In the supplied templates, it is
only used for hidden caches.
7. Templates
The templates contain ordinary HTML-code together with markups which
get substituted by geolog. First of all, one can use global
abbreviations that are defined in the file abbrev.txt and are
marked by being surrounded with double #-signs.
Furthermore, all attribute names and attribute values
are marked by being surrounded with single #-signs.
The syntax in the abbrev.txt is as follows. Each line that
contains a string surrounded with double-#'s starts a new
definition. All following lines until the next empty line define the
string that is abbreviated, e.g.:
##lefticon##
gc_small.gif
##leftref##
<a href="http://www.geocaching.com/">
All strings of the form #attribute
name:# are replaced by the respective attribute
name. The attribute values will be substituted for strings of the
form #attribute
name#. Text enclosed by #attribute name?#
#attribute name!# is only included, if the respective
attribute value is not the empty string. Similarly, text
enclosed by #-attribute name?#
#-attribute name!# is only included if the respective value is
the empty string. Repeating table
columns are enclosed by #<# and #>#.
The attribute names result from the field names described in Section
5. Additionally, there exist the following attributes:
- Counter - a global counter that counts up or down (see
below)
- CCounter - a conditional counter - counts and displays only
on lines that match a particular regular expression (see below)
- Hints - the hints (decoded) for hidden caches
- Log - the log (for found and not-found caches)
- Short - the short description of the cache (for hidden caches)
- Long - long description
- DirName - directory name
- image - a characteristic image (see below)
- thumbnails - thumbnails (see below)
- Finds - number of finds (from stat.txt)
- DNFs - number of DNFs (from stat.txt)
If you want to display attribute names or values differently, you can use
the translate.txt file.
If an attribute value end in .gif or .jpg, it is assumed that this is
a picture file in the pics sub-directory and it will be
replaced by an img-entry referring to the respective picture file.
In addition, #indexhtml# will either be replaced by the empty string
or by index.html depending on what the profile specifies.
Furthermore, #image# will be replaced by an img-entry referring to
image.jpg and #thumbnails# will be replaced by a set of
img-entries to files in the cache sub-directory pics.
Finally, it is possible to specify some parameters that influence the
appearance of the HTML files:
- #sort-by: attribute name# sorts by using the corresponding
attribute name
- #sort-order: (up|down)# influences the sort order
- #image-width: width in pixels# influences the size of the
main picture
- #image-align: align# specifies how the main picture should
be aligned
- #thumbnail-height: height in pixel# specifies height of
thumbnails in pixels
- #thumbnail-columns: column number# specifies number of
columns for thumbnails
- #ccounter: pattern# specifies pattern for conditional counter
- #ccount-order: (up|down)# specifies count order for
conditional counter
- #count-order: (up|down)# specifies count order for
global counter
Examples for using all these constructs used in template files and how
it looks like can be found on my website felias-fogg.de/.
8. Feedback
Please send praise, contributions (new template sets) and problem
descriptions to fogg at
gmx.de. If it is a problem description, please be as specific
as possible and send the log file of any problematic run of the
script.
9. License
GPL, of course!
Happy geocaching - fogg (geolog <at> felias-fogg.de)