geohasher 0.1.4

Simple geohash encode/decode functions without any dependencies.
Documentation
  • Coverage
  • 100%
    3 out of 3 items documented3 out of 3 items with examples
  • Size
  • Source code size: 23.58 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.28 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • conbrad/geohasher
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • conbrad

Geohasher

Crates.io Documentation codecov

Simple geohash encode/decode functions without any dependencies.

Installation

cargo install geohasher

Encoding

To encode a latitude and longitude into a geohash:

use geohasher::encode;

let geohash = encode(57.64911, 10.40744, 8);
assert_eq!(geohash, "u4pruydq");

Decoding

To decode a geohash back into latitude and longitude:

use geohasher::decode;

let (lat, lng) = decode("u4pruydq");
assert!((lat - 57.64911).abs() < 0.001);
assert!((lng - 10.40744).abs() < 0.001);

References:

According to Wikipedia:

"Geohash is a public domain geocode system invented in 2008 by Gustavo Niemeyer[1] which encodes a geographic location into a short string of letters and digits. Similar ideas were introduced by G.M. Morton in 1966[2]."

  1. https://web.archive.org/web/20080305223755/http://blog.labix.org/#post-85
  2. https://web.archive.org/web/20190125020453/https://domino.research.ibm.com/library/cyberdig.nsf/papers/0DABF9473B9C86D48525779800566A39/$File/Morton1966.pdf