[][src]Function geohash_16::decode

pub fn decode(hash_str: &str) -> Result<(Coordinate<f64>, f64, f64), Error>

Decode a geohash into a coordinate with some longitude/latitude error. The return value is (<coordinate>, <longitude error>, <latitude error>).

Examples

Decoding a length five geohash:

let geohash_str = "4d8c0";

let decoded = geohash::decode(geohash_str).expect("Invalid hash string");

assert_eq!(
    decoded,
    (
        geohash::Coordinate {
            x: -120.76171875,
            y: 35.244140625,
        },
        0.17578125,
        0.087890625,
    ),
);

Decoding a length ten geohash:

let geohash_str = "4d8c0f1817";

let decoded = geohash::decode(geohash_str).expect("Invalid hash string");

assert_eq!(
    decoded,
    (
        geohash::Coordinate {
            x: -120.66232681274414,
            y: 35.30035972595215,
        },
        0.000171661376953125,
        0.0000858306884765625,
    ),
);