This is the open-location-code Reference Manual, version 2.3, generated automatically by Declt version 4.0 beta 2 "William Riker" on Fri May 15 12:48:41 2026 GMT+0.
The main system appears first, followed by any subsystem dependency.
open-location-codeOpen Location Code library.
Ralph Schleicher <rs@ralph-schleicher.de>
Modified BSD License
2.3
alexandria (system).
iterate (system).
packages.lisp (file).
open-location-code.lisp (file).
read-code.lisp (file).
Files are sorted by type and then listed depth-first from the systems components trees.
open-location-code/open-location-code.asdopen-location-code/packages.lispopen-location-code/open-location-code.lispopen-location-code/read-code.lispopen-location-code/open-location-code.asdopen-location-code (system).
open-location-code/packages.lispopen-location-code (system).
open-location-code/open-location-code.lispopen-location-code (system).
center (generic function).
code-area (class).
code-error (condition).
code-length (generic function).
code-length-error (condition).
decode (function).
encode (function).
full-code-error (condition).
fullp (function).
invalid-code-error (condition).
north-east-corner (generic function).
pad-characters (generic function).
precision (generic function).
recover (function).
separator-position (generic function).
short-code-error (condition).
shorten (function).
shortp (function).
south-west-corner (generic function).
validp (function).
+alphabet+ (constant).
+area-height+ (constant).
+area-width+ (constant).
+block-divisor+ (constant).
+grid-columns+ (constant).
+grid-rows+ (constant).
+maximum-length+ (constant).
+maximum-precision+ (constant).
analyse (function).
area-size (function).
defconst (macro).
defsubst (macro).
digit (function).
digitp (function).
integer-from-degree (function).
length-from-precision (function).
normalize-location (function).
normalize-location* (function).
precision-from-length (function).
open-location-code/read-code.lispopen-location-code (system).
read-code (function).
Packages are listed by definition order.
open-location-codeOpen Location Code is a location encoding system for addresses,
independent of street names and building numbers. The encoded
location identifier is called Plus Code since it always contains
a plus sign character. For example, 8FX8QJ2G+QH is the Plus Code
of the Roman bridge in Trier, Germany.
See <https://plus.codes>.
olc
common-lisp.
iterate.
center (generic function).
code-area (class).
code-error (condition).
code-length (generic function).
code-length-error (condition).
decode (function).
encode (function).
full-code-error (condition).
fullp (function).
invalid-code-error (condition).
north-east-corner (generic function).
pad-characters (generic function).
precision (generic function).
read-code (function).
recover (function).
separator-position (generic function).
short-code-error (condition).
shorten (function).
shortp (function).
south-west-corner (generic function).
validp (function).
+alphabet+ (constant).
+area-height+ (constant).
+area-width+ (constant).
+block-divisor+ (constant).
+grid-columns+ (constant).
+grid-rows+ (constant).
+maximum-length+ (constant).
+maximum-precision+ (constant).
analyse (function).
area-size (function).
defconst (macro).
defsubst (macro).
digit (function).
digitp (function).
integer-from-degree (function).
length-from-precision (function).
normalize-location (function).
normalize-location* (function).
precision-from-length (function).
Definitions are sorted by export status, category, package, and then by lexicographic order.
Decode a Plus Code.
Argument CODE is a Plus Code (a string).
Keyword arguments START and END are the bounding indices of CODE.
Default is zero and the length of CODE respectively.
Primary value is a ‘code-area’ object. Secondary value is ‘:full’
or ‘:short’ if CODE is a full or short Plus Code respectively. If
CODE is a full Plus Code the code area denotes absolute coordinates.
Otherwise, the code area denotes relative coordinates, i.e. offset
values in the enclosing block.
Signal an ‘invalid-code-error’ if CODE is not a valid Plus Code.
Encode a location into a Plus Code.
First argument LATITUDE and second argument LONGITUDE denote the
location in degree angle. The latitude is clipped to the closed
interval [-90, 90] and the longitude is normalized to the
half-closed interval [-180, 180).
Optional third argument PRECISION is the precision of the code.
Default is five, i.e. a code length of ten digits.
Value is a full Plus Code (a string).
The relation between precision, code length, and code area size
is depicted in the following table.
Precision | Code Length | Width / m | Height / m
————-+————-+—————+—————
1 | 2 | 2218929.9 | 2218929.9
2 | 4 | 110946.5 | 110946.5
3 | 6 | 5547.3 | 5547.3
4 | 8 | 277.4 | 277.4
5 | 10 | 13.9 | 13.9
6 | 11 | 3.47 | 2.77
7 | 12 | 0.867 | 0.555
8 | 13 | 0.217 | 0.111
9 | 14 | 0.0542 | 0.0222
10 | 15 | 0.0135 | 0.00444
The code length is equal to the number of Plus Code digits. Pad characters and the separator character ‘+’ are not part of the code length. The code area dimensions are calculated with a mean earth radius of 6356766 m for a code area at the equator.
True if an object is a valid full Plus Code.
Argument CODE is an object of any type.
Keyword arguments START and END are the bounding indices of CODE.
Default is zero and the length of CODE respectively.
Value is true if CODE is a valid full Plus Code.
Otherwise, value is ‘nil’.
Read a Plus Code from an input stream.
Optional first argument STREAM is an input stream designator.
The default is standard input.
Optional second argument EOF-ERROR-P is a generalized boolean.
If an end of file error occurs and EOF-ERROR-P is false, EOF-VALUE
is returned. Otherwise, signal an ‘end-of-file’ error. The default
is true.
Optional third argument EOF-VALUE is an object. See above for more
details. The default is ‘nil’.
Optional fourth argument RECURSIVEP is a generalized boolean. True
means that this call is expected to be embedded in a higher-level
call to ‘read’ or a similar function used by the Lisp reader. The
default is false.
Keyword argument SHORT-CODE specifies the Plus Code format. A value
of ‘nil’ means to read a full Plus Code, ‘t’ means to read a short
Plus Code, and any other value means to read any valid Plus Code.
The default is ‘nil’.
Return value is the Plus Code (a string), or ‘nil’ if no valid Plus
Code in the specified format can be read. Secondary value is the
number of characters read from STREAM.
The ‘read-code’ function expects a Plus Code in the specified format.
Leading or trailing whitespace is not ignored. Reading stops at the
end of the file or if an invalid character occurs. That means, the
next character read from STREAM is the invalid character.
If the file ends in the middle of a Plus Code, ‘read-code’ signals an ‘end-of-file’ error regardless of the value of the EOF-ERROR-P argument.
Recover a full Plus Code from a short code and a reference location.
First argument CODE is a Plus Code (a string).
Second argument LATITUDE and third argument LONGITUDE denote the
reference location in degree angle. The latitude is clipped to
the closed interval [-90, 90] and the longitude is normalized to
the half-closed interval [-180, 180).
Keyword arguments START and END are the bounding indices of CODE.
Default is zero and the length of CODE respectively.
Value is the recovered full code. If CODE is already a full code,
return CODE as is.
Signal an ‘invalid-code-error’ if CODE is not a Plus Code.
Remove four, six, or eight digits from the front of a full Plus
Code given a reference location.
First argument CODE is a full Plus Code (a string).
Second argument LATITUDE and third argument LONGITUDE denote the
reference location in degree angle. The latitude is clipped to
the closed interval [-90, 90] and the longitude is normalized to
the half-closed interval [-180, 180).
Keyword arguments START and END are the bounding indices of CODE.
Default is zero and the length of CODE respectively.
Value is the short code, or the original full code if the reference
location is too far.
Signal a ‘full-code-error’ if CODE is not a full Plus Code.
True if an object is a valid short Plus Code.
Argument CODE is an object of any type.
Keyword arguments START and END are the bounding indices of CODE.
Default is zero and the length of CODE respectively.
Value is true if CODE is a valid full Plus Code.
Otherwise, value is ‘nil’.
True if an object is a valid sequence of Plus Code characters.
Argument CODE is an object of any type.
Keyword arguments START and END are the bounding indices of CODE.
Default is zero and the length of CODE respectively.
Value is ‘:full’ or ‘:short’ if CODE is a valid full or short Plus Code respectively. Otherwise, value is ‘nil’.
Return the center latitude and longitude as multiple values.
Return the Plus Code length.
integer)) ¶Return the code length as a function of the precision.
Return the upper latitude and longitude as multiple values. The upper bounds are not included in the code area except for the north pole.
Return the number of pad characters.
Return the Plus Code precision.
integer)) ¶Return the precision as a function of the code length.
Return the position of the separator character.
Return the lower latitude and longitude as multiple values.
Base class for all Open Location Code errors.
type-error.
Condition for an invalid Plus Code length.
Condition for an invalid full Plus Code.
Condition for an invalid Plus Code.
Condition for an invalid short Plus Code.
Area covered by a Plus Code.
Lower latitude of the code area in degree angle.
real
0
Lower longitude of the code area in degree angle.
real
0
Height of the code area in degree angle.
real
0
Width of the code area in degree angle.
real
0
Precision of the original code.
fixnum
0
Code length of the original code.
common-lisp.
fixnum
0
Position of the separator character in the original code.
fixnum
0
Number of pad characters in the original code.
fixnum
0
Set of valid digits, i.e. encoding characters. The character position is equal to the decimal value, i.e. weight, of the digit.
Vector of code area heights in descending order. Element position is the precision of the code area.
Vector of code area widths in descending order. Element position is the precision of the code area.
Divisor when splitting a block into sub-blocks.
Number of grid columns.
Number of grid rows.
Maximum code length excluding the plus sign character.
Maximum number of discretization steps.
Define a constant variable.
This is like ‘defconstant’ except that the initially set value is reused when the ‘defconst’ form is evaluated again.
Define an inline function.
This is like ‘defun’ except that the function is globally marked for inline expansion by the compiler.
Analyse a Plus Code.
First argument CODE is the Plus Code (an object).
Second argument START is the lower bounding index of CODE.
Third argument END is the upper bounding index of CODE.
If optional fourth argument AREA is not ‘nil’, secondary value
is a code area object.
Primary value is ‘:full’ or ‘:short’ if CODE is a valid full or short Plus Code respectively. Otherwise, all values are ‘nil’.
Return the height and width of a code area as multiple values.
Argument PRECISION is the number of discretization steps.
Return the digit for a decimal value.
Argument VALUE has to be a non-negative integer less than 20.
Value is the digit, i.e. encoding character.
True if CHAR is a valid digit.
Argument CHAR has to be a character.
Value is the decimal value, i.e. weight, of the digit, or ‘nil’ if CHAR is an invalid digit.
Convert a location into non-negative integers.
Return the code length as a function of the precision.
Clip LATITUDE to the half-closed interval [-90°, 90°) and
normalize LONGITUDE to the half-closed interval [-180°, 180°).
Third argument PRECISION is used to determine the height of
the code area if LATITUDE denotes the north pole.
Values are latitude, longitude, and the actual precision.
Like ‘normalize-location’ but return latitude and longitude as non-negative numbers, i.e. add 90° to the latitude and 180° to the longitude.
Return the precision as a function of the code length.
| Jump to: | A C D E F G I L M N P R S V |
|---|
| Jump to: | A C D E F G I L M N P R S V |
|---|
| Jump to: | +
C H L P S W |
|---|
| Jump to: | +
C H L P S W |
|---|
| Jump to: | C F I O P R S |
|---|
| Jump to: | C F I O P R S |
|---|