OpenLocationCode v1.0.0 OpenLocationCode View Source

Documentation for OpenLocationCode.

Link to this section Summary

Functions

Generates an OpenLocationCode.CodeArea struct from a given Open Location Code

Same as decode/1 except will throw an exception if invalid

Generates a Open Location Code from the given coordinates. latitude and longitude

Same as encode/1 except will throw an exception if invalid

Determines if a string is a valid full Open Location Code

Recovers a full Open Location Code from a short code and a reference location.

Determines if a string is a valid short Open Location Code.

Removes four, six or eight digits from the front of an Open Location Code given a reference location.

Determines if a string is a valid sequence of Open Location Code characters.

Link to this section Functions

Link to this function

decode(code)

View Source
decode(binary()) :: {:ok, OpenLocationCode.CodeArea.t()} | {:error, binary()}

Generates an OpenLocationCode.CodeArea struct from a given Open Location Code

Same as decode/1 except will throw an exception if invalid

Link to this function

encode(latitude, longitude, code_length \\ 10)

View Source
encode(number(), number(), integer()) :: {:ok, binary()} | {:error, binary()}

Generates a Open Location Code from the given coordinates. latitude and longitude

Examples

iex> OpenLocationCode.encode(29.952062, -90.077188)
{:ok, "76XFXW2F+R4"}
Link to this function

encode!(latitude, longitude, code_length \\ 10)

View Source
encode!(number(), number(), integer()) :: binary()

Same as encode/1 except will throw an exception if invalid

Examples

iex> OpenLocationCode.encode!(29.952062, -90.077188)
"76XFXW2F+R4"

Determines if a string is a valid full Open Location Code

Link to this function

recover_nearest(short_code, reference_latitude, reference_longitude)

View Source

Recovers a full Open Location Code from a short code and a reference location.

Determines if a string is a valid short Open Location Code.

Link to this function

shorten(code, latitude, longitude)

View Source
shorten(binary(), number(), number()) :: binary()

Removes four, six or eight digits from the front of an Open Location Code given a reference location.

Determines if a string is a valid sequence of Open Location Code characters.