olctools (version 0.3.0)

encode_olc: Encode Latitude and Longitude Pairs as Open Location Codes

Description

encode_olc creates Open Location Codes from latitude and longitude values, of a specified length.

Usage

encode_olc(lats, longs, length)

Arguments

lats
a numeric vector of latitudes.
longs
a numeric vector of longitudes, equivalent in size to lats
length
the length you want the resulting OLCs to be. The conventional lengths are 10 or 11, with any number above 8 and any even number below it being acceptable. length should consist of either a single value, if you want all codes to be calculated to the same length, or a vector of values the same size as lats and longs if you want to pre-set values.

See Also

decode_olc for the opposite operation, and shorten_olc to convert "full" Open Location Codes to "short" Open Location Codes.

Examples

Run this code
encode_olc(20.375, 2.775,6)

Run the code above in your browser using DataLab