[−][src]Crate geohash_16
Geohash
Geohash algorithm implementation in Rust. It encodes/decodes a longitude-latitude tuple into/from a hashed string. You can find more about the original geohash algorithm on Wikipedia This crate provides an alternative base16 encoded version
Usage
extern crate geohash; use std::error::Error; use geohash::{encode, decode, neighbor, Direction, Coordinate}; fn main() -> Result<(), Box<Error>> { // encode a coordinate let c = Coordinate { x: 112.5584f64, y: 37.8324f64 }; println!("encoding 37.8324, 112.5584: {}", encode(c, 9usize)?); // decode a geohash let (c, _, _) = decode("e71150dc9")?; println!("decoding ww8p1r4t8 to: {}, {}", c.y, c.x); // find a neighboring hash let sw = neighbor("e71150dc9", Direction::SW)?; Ok(()) }
Structs
Coordinate | A lightweight struct used to store coordinates on the 2-dimensional Cartesian plane. |
Neighbors | |
Rect | A bounded 2D quadrilateral whose area is defined by minimum and maximum |
Enums
Direction | |
GeohashError |
Functions
decode | Decode a geohash into a coordinate with some longitude/latitude error. The
return value is |
decode_bbox | Decode geohash string into latitude, longitude |
encode | Encode a coordinate to a geohash with length |
neighbor | Find neighboring geohashes for the given geohash and direction. |
neighbors | Find all neighboring geohashes for the given geohash. |