GNSS-SDR  0.0.19
An Open Source GNSS Software Defined Receiver
Public Member Functions | List of all members
Geohash Class Reference

Class for geohash encoding / decoding See https://en.wikipedia.org/wiki/Geohash. More...

#include <geohash.h>

Public Member Functions

std::string encode (double lat, double lon, int precision=-1) const
 
std::array< double, 2 > decode (std::string geohash) const
 

Detailed Description

Class for geohash encoding / decoding See https://en.wikipedia.org/wiki/Geohash.

Definition at line 34 of file geohash.h.

Member Function Documentation

◆ decode()

std::array<double, 2> Geohash::decode ( std::string  geohash) const

Decode geohash to latitude/longitude (location is approximate centre of geohash cell, to reasonable precision).

Parameters
{string}geohash - Geohash string to be converted to latitude/longitude.
Returns
{lat, lon} (Center of) geohashed location.
Exceptions
Invalidgeohash.

◆ encode()

std::string Geohash::encode ( double  lat,
double  lon,
int  precision = -1 
) const

Encodes latitude/longitude to geohash, either to specified precision or to automatically evaluated precision.

Parameters
{double}lat - Latitude in degrees.
{double}lon - Longitude in degrees.
{int}[precision] - Number of characters in resulting geohash.
Returns
{string} Geohash of supplied latitude/longitude.
Exceptions
Invalidgeohash.

The documentation for this class was generated from the following file: