Method: OpenLocationCode.encode
- Defined in:
- lib/open_location_code.rb
.encode(latitude, longitude, code_length = nil) ⇒ String
Encode a location into an Open Location Code.
Produces a code of the specified length, or the default length if no length
is provided.
The length determines the accuracy of the code. The default length is
10 characters, returning a code of approximately 13.5x13.5 meters. Longer
codes represent smaller areas, but lengths > 14 are sub-centimetre and so
11 or 12 are probably the limit of useful codes.
93 94 95 |
# File 'lib/open_location_code.rb', line 93 def self.encode(latitude, longitude, code_length = nil) Encoder.new(latitude, longitude, code_length || PAIR_CODE_LENGTH).process end |