Geohash: Difference between revisions

Content deleted Content added
Wherrera (talk | contribs)
add decoder
Wherrera (talk | contribs)
Line 172: Line 172:
function decoder(geo)
function decoder(geo)
minmaxes, latlong = [[-90.0, 90.0], [-180.0, 180.0]], 2
minmaxes, latlong = [[-90.0, 90.0], [-180.0, 180.0]], 2
for s in [ch for ch in geo], bit in ch2bool[s]
for c in [ch for ch in geo], bit in ch2bool[c]
minmaxes[latlong][bit == '1' ? 1 : 2] = sum(minmaxes[latlong]) / 2
minmaxes[latlong][bit == '1' ? 1 : 2] = sum(minmaxes[latlong]) / 2
latlong = 3 - latlong
latlong = 3 - latlong