MCPcopy Index your code
hub / github.com/python/cpython / geohash

Function geohash

Lib/antigravity.py:7–17  ·  view source on GitHub ↗

Compute geohash() using the Munroe algorithm. >>> geohash(37.421542, -122.085589, b'2005-05-26-10458.68') 37.857713 -122.544543

(latitude, longitude, datedow)

Source from the content-addressed store, hash-verified

5webbrowser.open("https://xkcd.com/353/")
6
7def geohash(latitude, longitude, datedow):
8 '''Compute geohash() using the Munroe algorithm.
9
10 >>> geohash(37.421542, -122.085589, b'2005-05-26-10458.68')
11 37.857713 -122.544543
12
13 '''
14 # https://xkcd.com/426/
15 h = hashlib.md5(datedow, usedforsecurity=False).hexdigest()
16 p, q = [('%f' % float.fromhex('0.' + x)) for x in (h[:16], h[16:32])]
17 print('%d%s %d%s' % (latitude, p[1:], longitude, q[1:]))

Callers

nothing calls this directly

Calls 1

hexdigestMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…