Centicule

From Geohashing
(Redirected from Decicule)

Within the same year as the publication of the Algorithm and the elucidation of the concept of the graticule, demand for a significantly smaller areal unit for various purposes arose. Eventually‡ it was decided that a subdivision of the graticule unit into 100 pieces, ten to the side of a graticule (a.k.a. six minutes of arc) -- hence called centicule or decicule to refer to these ratios using SI prefixes (this article will use 'centicule' since it is more common) -- would do nicely. Although the -cule suffix is inherited from 'graticule', one could also consider as a back-formation that since the entity is designed to be smaller that it receives a diminutive.

APR and Robyn are responsible for developing the concept for the notify program; the first draft divided the graticule eight parts to an edge before settling on the decimalised version to better fit the format coordinates are often presented in.

measures and statistics

Centicules are as tall as the polar circumference of the Earth divided by 3600, and like graticules vary in width from top to bottom and depending on their position between equator and poles. Centicules can be used to describe a location within a graticule, for example in the Notification program. Some people keep track of which centicules they have visited while hashing, either within a particular graticule or relative to the corner/edge of any/all graticules visited.

Thanks to user:JesseW, you can use the following website to visualize centicules:

http://output.jsbin.com/equvix/latest?lat=39&lng=-77

Pinecone's algorithm

Note: This was an experimental proposal that never took hold.

A decicule is approximately one hundredth the area of a graticule, or more precisely the set of coordinates that has a common integer part and tenths digit for both the latitude and longitude. This follows the proposal set forth by Pinecone.

A decihash of a decicule is the same as the geohash of the graticule of which it is a part, except differing in the tenths digit where it takes the tenth digit of the decicule. This follows Pinecone's basic philosophy, but makes it simpler based on Rspeer's comments.

Implementation

# decihash.py
# by Paradoxian, based on Python implementation 2 at:
# http://wiki.xkcd.com/geohashing/Implementations

import hashlib, datetime, struct, urllib, re, sys, math, webbrowser
myLat = 34.0
myLon = -118.3
args = sys.argv
if len(args) == 1:
    args.append(myLat)
    args.append(myLon)
args[1] = float(args[1])
args[2] = float(args[2])
deciculeN = math.modf(args[1] * 10)[1] / 10
deciculeE = math.modf(args[2] * 10)[1] / 10

# may print wrong sign if rounds to -0.0, but result will still be correct
print "Decicule:", deciculeN, deciculeE

if args[2] < -30:
    td30 = 0
else:
    td30 = 1
if args[1] < 0:
    south = -1
else:
    south = 1
if args[2] < 0:
    west = -1
else:
    west = 1
date = datetime.date.today()
djia = urllib.urlopen((date - datetime.timedelta(td30)).strftime("http://geo.crox.net/djia/%Y/%m/%d")).read()
if '404 Not Found' in djia: sys.exit(sys.stderr.write("Dow Jones not available yet.\n"))
sum = hashlib.md5("%s-%s" % (date, djia)).digest()
north, east = [str( d * (abs(a) + (f-(math.floor(f*10)/10)) ) ) for d, f, a in zip((south, west),
    [x/2.**64 for x in struct.unpack_from(">QQ", sum)], (deciculeN, deciculeE) )]
print "Decihash:", north, east
dest = 'http://maps.google.com/maps?f=q&hl=en&geocode=&q=' + north + '+' + east + '&ie=UTF8&ll=' + north + ',' + east + '&spn=0.918082,1,864929&z=9&iwloc=addr'
print "URL:", dest
webbrowser.open(dest)