Module: PlusCodes

Defined in:
lib/plus_codes.rb,
lib/plus_codes/version.rb,
lib/plus_codes/code_area.rb,
lib/plus_codes/open_location_code.rb

Overview

Plus+Codes is a Ruby implementation of Google Open Location Code(Plus+Codes).

Author:

  • We-Ming Wu

Defined Under Namespace

Classes: CodeArea, OpenLocationCode

Constant Summary collapse

SEPARATOR =

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

'+'.freeze
SEPARATOR_POSITION =

The number of characters to place before the separator.

8
PADDING =

The character used to pad codes.

'0'.freeze
CODE_ALPHABET =

The character set used to encode the values.

'23456789CFGHJMPQRVWX'.freeze
ENCODING_BASE =

The base to use to convert numbers to/from.

CODE_ALPHABET.length
LATITUDE_MAX =

The maximum value for latitude in degrees.

90
LONGITUDE_MAX =

The maximum value for longitude in degrees.

180
PAIR_CODE_LENGTH =

Maximum code length using lat/lng pair encoding. The area of such a code is approximately 13x13 meters (at the equator), and should be suitable for identifying buildings. This excludes prefix and separator characters.

10
PAIR_RESOLUTIONS =

The resolution values in degrees for each position in the lat/lng pair encoding. These give the place value of each position, and therefore the dimensions of the resulting area.

[20.0, 1.0, 0.05, 0.0025, 0.000125].freeze
GRID_COLUMNS =

Number of columns in the grid refinement method.

4
GRID_ROWS =

Number of rows in the grid refinement method.

5
GRID_SIZE_DEGREES =

Size of the initial grid in degrees.

0.000125
MIN_TRIMMABLE_CODE_LEN =

Minimum length of a code that can be shortened.

6
DECODE =

Decoder lookup table. -2: illegal. -1: Padding or Separator >= 0: index in the alphabet.

[
-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -1, -2, -2, -2, -2,
-1, -2,  0,  1,  2,  3,  4,  5,  6,  7, -2, -2, -2, -2, -2, -2,
-2, -2, -2,  8, -2, -2,  9, 10, 11, -2, 12, -2, -2, 13, -2, -2,
14, 15, 16, -2, -2, -2, 17, 18, 19, -2, -2, -2, -2, -2, -2, -2,
-2, -2, -2,  8, -2, -2,  9, 10, 11, -2, 12, -2, -2, 13, -2, -2,
14, 15, 16, -2, -2, -2, 17, 18, 19, -2, -2, -2, -2, -2, -2, -2,].freeze
VERSION =
'0.1.1'