openlocationcode

Convert locations to and from convenient short codes.

Open Location Codes are short, ~10 character codes that can be used instead of street addresses. The codes can be generated and decoded offline, and use a reduced character set that minimises the chance of codes including words.

Ported from the Java interface.

@author Jiri Semecky @author Doug Rinckes @author Jan Jurzitza

Members

Classes

OLCFormatException
class OLCFormatException

Thrown in methods validating a user input string code.

Functions

isFullCode
bool isFullCode(string code)

Returns if the code is a valid full Open Location Code.

isFullUppercaseCode
bool isFullUppercaseCode(string code)

Does the same as isFullCode, assuming the code is already uppercase, making this @nogc nothrow.

isShortCode
bool isShortCode(string code)

Returns if the code is a valid short Open Location Code.

isShortUppercaseCode
bool isShortUppercaseCode(string code)

Does the same as isShortCode, assuming the code is already uppercase, making this @nogc nothrow.

isValidCode
bool isValidCode(string codeString)

Returns whether the provided string is a valid Open Location code.

isValidCodeLength
bool isValidCodeLength(int codeLength)

Returns whether the provided code length

isValidUppercaseCode
bool isValidUppercaseCode(string codeString)

Same as isValidCode but doesn't convert the code to uppercase before handling, thus failing validation when using lowercase characters.

Manifest constants

codePrecisionNormal
enum codePrecisionNormal;

Provides a normal precision code, approximately 14x14 meters.

maxDigitCount
enum maxDigitCount;

The max number of digits to process in a plus code.

maxOLCLength
enum maxOLCLength;

The max number of characters in an open location code. This is the max number of digits plus a separator character.

paddingCharacter
enum paddingCharacter;

The character used to pad codes.

separator
enum separator;

A separator used to break the code into two parts to aid memorability.

Static variables

codeAlphabet
ubyte[] codeAlphabet;

The character set used to encode the values.

Structs

OpenLocationCode
struct OpenLocationCode

Represents an open location code.

OpenLocationCodeArea
struct OpenLocationCodeArea

Coordinates of a decoded Open Location Code.

Meta