Recover Full Open Location Codes From Shortened Codes

Share:

Description

shorten_olc (and other sources) shorten a code, reducing the space it occupies. They also limit its ability to be translated back into latitude/longitude pairs. recover_olc recovers a full code from a shortened one, allowing it to be decoded with decode_olc. Some loss of accuracy or precision is expected - and as it finds the closest match to the coordinates rather than to the original code, the characters may be very different.

Usage

1
recover_olc(olcs, lats, longs)

Arguments

olcs

a vector of short open location codes, generated with shorten_olc or through any other means.

lats

a numeric vector of latitudes.

longs

a numeric vector of longitudes, equivalent in size to lats.

Examples

1
2
3
# Shorten an OLC and then recover the nearest full code. Note the actual characters differ.
shortened_code <- shorten_olc("8FVC9G8F+6X", 47.5, 8.5);
recovered_code <- recover_olc(shortened_code, 47.4, 8.6);