Skip to content Search Apps Documentation Source Content Run Reset Eval Playground File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Geohash

Turning a latitude and longitude into a short base32 string, demoing the p/moul/x/daily/geohash library.

The box ezs42 names

A geohash is a box, never a point, and the shorter the hash the bigger the box.

latitude   42.5830078125 .. 42.626953125
longitude  -5.625 .. -5.5810546875
size       0.0439453125 by 0.0439453125 degrees

Decode reports the centre, 42.60498046875, -5.60302734375, because the centre is the best single point a box can give. The coordinates that produced the hash, 42.6, -5.6, are inside it: yes.

Null Island is not: no.

Next: /neighbors.