Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
67 lines (48 sloc) 1.75 KB
\documentclass{article}
\title{libgeohash}
\author{Derek Smith \\ derek@simplegeo.com}
\begin{document}
\maketitle
\begin{abstract}
A static library used for encoding/decoding geohashes.
\end{abstract}
\section{Description}
\section{Usage}
To use \textit{libgeohash} just run \texttt{make}. Link \textbf{libgeohash.a} and include \textbf{geohash.h} into your project.
\subsection{Encode}
\begin{verbatim}
char* geohash_encode(double lat, double lng, int precision);
\end{verbatim}
Takes in latitude and longitude with a desired precision and returns the correct hash value. If
\(precision < 0\) or \(precision > 20\), a default value of \texttt{12} will be used.
\subsection{Decode}
\begin{verbatim}
GeoCoord geohash_decode(char* hash);
\end{verbatim}
Produces an allocated GeoCoord structure which contains the \texttt{latitude} and \texttt{longitude} that was decoded from
the geohash. A GeoCoord also provides the bounding box for the geohash (\texttt{north}, \texttt{east}, \texttt{south}, \texttt{west}).
\subsection{Neighbors}
\begin{verbatim}
char** geohash_neighbors(char* hash);
\end{verbatim}
Uses the bounding box declared at \texttt{hash} and calculates the 8 neighboring boxes. An example is show below.
\begin{center}
\begin{tabular}{| c | c | c |}
\hline
ezefx & ezs48 & ezs49 \\ \hline
ezefr & \textbf{ezs42} & ezs43 \\ \hline
ezefp & ezs40 & ezs41 \\ \hline
\end{tabular}
\end{center}
The value returned is an array of \texttt{char*} with length of 8. The neighboring positions of values are shown below with each box representing the index of the array.
\begin{center}
\begin{tabular}{| c | c | c |}
\hline
7 & 0 & 1 \\ \hline
6 & & 2 \\ \hline
5 & 4 & 3 \\ \hline
\end{tabular}
\end{center}
\section{Contact Information}
derek@simplegeo.com
\end{document}