decode

Function decode 

Source
pub fn decode(geohash: &str) -> (f64, f64)
Expand description

Decodes a geohash string into latitude and longitude coordinates.

This function takes a geohash string and converts it back into its corresponding latitude and longitude coordinates. The geohash is a base32-encoded string that represents a rectangular area on the Earth’s surface.

§Arguments

  • geohash - A string slice that holds the geohash to be decoded.

§Returns

A tuple containing two f64 values:

  • The first value is the latitude in degrees.
  • The second value is the longitude in degrees.

§Example

use geohasher::decode;

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

§Note

The precision of the returned coordinates depends on the length of the input geohash. Longer geohashes provide more precise coordinates.