<?xml version="1.0" encoding="UTF-8"?>
<essay xml:lang="en" version="lillet" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:gal="http://norman.walsh.name/rdf/gallery#">
<info>
    
    
    
    
    
    
    
    
    
    
<title>Geocaching with decimal degrees</title><biblioid class="uri">http://norman.walsh.name/2005/09/27/monkeyCache</biblioid>
<volumenum>8</volumenum>
<issuenum>124</issuenum>
<pubdate>2005-09-27T13:06:32+01:00</pubdate>
<date>$Date: 2006-05-01 07:08:23 -0400 (Mon, 01 May 2006) $</date>
<author>
      <personname>
<firstname>Norman</firstname>
	<surname>Walsh</surname>
</personname>
    </author>
<copyright>
      <year>2005</year>
      <holder>Norman Walsh</holder>
    </copyright>
<abstract>
<para>My first GreaseMonkey script provides decimal degrees for cache
locations. [Update: now to five decimal places.]</para>
</abstract>
<dc:subject rdf:resource="http://norman.walsh.name/knows/taxonomy#Firefox"/>
<dc:subject rdf:resource="http://norman.walsh.name/knows/taxonomy#Geocaching"/>
<dc:subject rdf:resource="http://norman.walsh.name/knows/taxonomy#Greasemonkey"/>
</info>

<para xml:id="p1">The cache pages at
<link xlink:href="http://www.geocaching.com/">geocaching.com</link>
provide latitudes and longitudes in degrees and minutes
(e.g., “N 42° 17.853”). I find that I often want to convert
those coordinates into decimal degrees (e.g., “42.2975”) to plot them
together on maps, to calculate distances between them, etc. I did
it by hand a number of times before I discovered that the easiest way
is to peek into the mapping URIs further down on the cache
page.</para>

<para xml:id="p2">But that's still a little bit inconvenient, and
isn't this exactly what
<link xlink:href="http://en.wikipedia.org/wiki/Greasemonkey">Greasemonkey</link>
is for?</para>

<para xml:id="p3">Given that I've started to feel a little left out as
I haven't written any fancy
<link xlink:href="http://en.wikipedia.org/wiki/DHTML">DHTML</link>
interfaces or jumped on the
<link xlink:href="http://en.wikipedia.org/wiki/Ajax_%28programming%29">Ajax</link>
bandwagon to write the all-singing, all-dancing interactive DocBook
web site, I thought that writing some Greasemonkey code would make me
feel a little more relevant.</para>

<para xml:id="p4">I was right. And now I have
<link xlink:href="examples/geocaching.user.js">a script</link> that
adds decimal degrees to the pages in question. See?</para>

<mediaobject role="flickr">
    <!--Geocaching.com page with decimal degrees-->
  <imageobject xlink:href="http://www.flickr.com/photos/ndw/47111126/">
    <imagedata fileref="http://static.flickr.com/30/47111126_4fd10a5c08.jpg"/>
  </imageobject>
</mediaobject>

<para xml:id="p5">It's probably embarrassingly bad
<link xlink:href="http://en.wikipedia.org/wiki/Javascript">JavaScript</link>
coding, but that's what you get for a lunch break exercise at a
working group meeting. Improvements accepted.</para>

<para xml:id="p6">[Update 1 May 2006: Carl's right, four decimal places wasn't really
enough. I've updated 
<link xlink:href="examples/geocaching.user.js">the script</link> to provide
five, padded with zeros if necessary.]</para>

</essay>

