MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / geohash_decode_center

Function geohash_decode_center

nodedb-spatial/src/geohash.rs:148–155  ·  view source on GitHub ↗

Decode a geohash to its center point (longitude, latitude).

(hash: &str)

Source from the content-addressed store, hash-verified

146
147/// Decode a geohash to its center point (longitude, latitude).
148pub fn geohash_decode_center(hash: &str) -> Option<(f64, f64)> {
149 geohash_decode(hash).map(|bb| {
150 (
151 (bb.min_lng + bb.max_lng) / 2.0,
152 (bb.min_lat + bb.max_lat) / 2.0,
153 )
154 })
155}
156
157/// Direction for neighbor computation.
158#[derive(Debug, Clone, Copy, PartialEq, Eq)]

Callers 1

decode_centerFunction · 0.85

Calls 1

geohash_decodeFunction · 0.85

Tested by 1

decode_centerFunction · 0.68