Latest 1.1.1
License MIT
Platforms ios 9.0, osx 10.10, watchos 2.0, tvos 9.0





A Swift implementation of the geohash algorithm.

Geodesy comes from the ancient Greek word γεωδαισία which dividing the earth. This is basically what the geohash algorithm does. The hash is just a string of characters, the first divides the earth into 32 separate regions, measured precisely along lines of latitude and longitude. Then next character subdivides a region further into 32 subsections. On and on it goes, each added character more precisely specifying a location on the globe. Nice!

The beauty of the algorithm really shines when you want to search a set of locations for the ones near a given location. Instead of running some complicated trigonometry on all the points, you can simply compare geohashes. The nearest points will be the ones who share the longest prefix with the given point’s geohash.

let currentLocation = user.location.geohash()
let nearby = db.hotspots.where("geohash", beginsWith: currentLocation.prefix(8))

Violá. A hash length 8 characters long defines a square roughly 38 meters per side.

Latest podspec

    "name": "Geodesy",
    "version": "1.1.1",
    "summary": "A Swift implementation of the geohash algorithm.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": ""
    "authors": "Todd Olsen",
    "social_media_url": "",
    "platforms": {
        "ios": "9.0",
        "osx": "10.10",
        "watchos": "2.0",
        "tvos": "9.0"
    "source": {
        "git": "",
        "tag": "1.1.1"
    "source_files": "Source/*.swift",
    "pushed_with_swift_version": "4.0"

Pin It on Pinterest

Share This