Skip to content

evuez/geohax

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Geohax

Hex.pm Build Status Inline docs Hex.pm

Geohash encoding and decoding for Elixir.

Usage

Encoding and decoding

iex> Geohax.encode(-132.83, -38.1033, 6)
"311x1r"
iex> Geohax.decode("311x1r")
{-132.83, -38.1033}

Note that the format for coordinates is {longitude, latitude}.

Finding neighbors

iex> Geohax.neighbors("311x1r")
[north: "311x32", south: "311x1q", east: "311x1x", west: "311x1p"]
iex> Geohax.neighbor("311x1r", :north)
"311x32"

Installation

Add the :geohax dependency to your mix.exs file:

defp deps do
  [{:geohax, ">= 0.0.0"}]
end

Then, run mix deps.get to fetch the new dependency.