26 releases
| new 0.13.2 | May 24, 2026 |
|---|---|
| 0.13.1 | Mar 13, 2024 |
| 0.13.0 | Jan 15, 2023 |
| 0.12.0 | Oct 8, 2021 |
| 0.1.1 | Nov 21, 2014 |
#126 in Geospatial
231,028 downloads per month
Used in 66 crates
(14 directly)
115KB
261 lines
Geohash
Geohash algorithm implementation in Rust. It encodes/decodes a longitude-latitude tuple into/from a hashed string. You can find more about geohash algorithm on Wikipedia
Usage
extern crate geohash;
use std::error::Error;
use geohash::{encode, decode, neighbor, Direction, Coord};
fn main() -> Result<(), Box<Error>> {
// encode a coordinate
let c = Coord { x: 112.5584f64, y: 37.8324f64 };
println!("encoding 37.8324, 112.5584: {}", encode(c, 9usize)?);
// decode a geohash
let (c, _, _) = decode("ww8p1r4t8")?;
println!("decoding ww8p1r4t8 to: {}, {}", c.y, c.x);
// find a neighboring hash
let sw = neighbor("ww8p1r4t8", Direction::SW)?;
Ok(())
}
Rust-Geohash
Rust-Geohash is a Rust library for Geohash algorithm. Ported from node-geohash module.
Docs
Check the API doc at docs.rs
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Dependencies
~0.8–1.1MB
~23K SLoC