Latest1.1.1
Homepagehttps://github.com/proxpero/Geodesy
LicenseMIT
Platformsios 9.0, osx 10.10, watchos 2.0, tvos 9.0

Geodesy
codecov

MIT


CocoaPods


Swift

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": "https://github.com/proxpero/Geodesy",
    "license": {
        "type": "MIT",
        "file": "LICENSE.md"
    },
    "authors": "Todd Olsen",
    "social_media_url": "http://twitter.com/proxpero",
    "platforms": {
        "ios": "9.0",
        "osx": "10.10",
        "watchos": "2.0",
        "tvos": "9.0"
    },
    "source": {
        "git": "https://github.com/proxpero/Geodesy.git",
        "tag": "1.1.1"
    },
    "source_files": "Source/*.swift",
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This