Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #3

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@
This is yet another Geohash library written in Swift.

## Usage

if let (lat, lon) = Geohash.decode(hash: "u4pruydqqvj") {
// lat.min == 57.649109959602356
// lat.max == 57.649111300706863
// lon.min == 10.407439023256302
// lon.max == 10.407440364360809
}
let s = Geohash.encode(latitude: 57.64911063015461, longitude: 10.40743969380855, length: 10)
// s == "u4pruydqqv"

```swift
if let (lat, lon) = Geohash.decode(hash: "u4pruydqqvj") {
// lat.min == 57.649109959602356
// lat.max == 57.649111300706863
// lon.min == 10.407439023256302
// lon.max == 10.407440364360809
}

let s = Geohash.encode(latitude: 57.64911063015461, longitude: 10.40743969380855, length: 10)
// s == "u4pruydqqv"
```
## CLLocationCoordinate2D extension

if let l = CLLocationCoordinate2D(geohash: "u4pruydqqvj") {
// l.latitude == 57.64911063015461
// l.longitude == 10.407439693808556
}
let l = CLLocationCoordinate2DMake(57.64911063015461, 10.40743969380855)
let s = l.geohash(length: 10)
// s == u4pruydqqv

```swift
if let l = CLLocationCoordinate2D(geohash: "u4pruydqqvj") {
// l.latitude == 57.64911063015461
// l.longitude == 10.407439693808556
}

let l = CLLocationCoordinate2DMake(57.64911063015461, 10.40743969380855)
let s = l.geohash(length: 10)
// s == u4pruydqqv
```
## Installation

Copy [Geohash.swift](https://raw.githubusercontent.com/nh7a/Geohash/master/Geohash/Geohash.swift) into your project.
Expand Down