Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content
This repository has been archived by the owner on Mar 21, 2023. It is now read-only.
/ olc Public archive

Convert coordinates between Latitude/Longitude and Open Location Code

License

Notifications You must be signed in to change notification settings

glv2/olc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

olc

The active repository is at https://codeberg.org/glv/olc

This is a Common Lisp library to convert coordinates between Latitude/Longitude and Open Location Code.

API

In the library, latitude and longitude are represented by real numbers (degrees), positive for northern latitude and eastern longitudes, and negative for southern latitude and western longitudes.

(lat/lon->olc latitude longitude &optional extra-precision) -> string

Return the Open Location Code for the given latitude and longitude. If extra-precision is not nil, an 11 digit code will be returned instead of a 10 digit one.

(olc->lat/lon code &optional center-p) -> list

Return the latitude and longitude for the southwest corner of the given Open Location Code square, or the center of the square if center-p is not nil.

Examples

Load the library:

> (asdf:load-system "olc")
...

Get the Open Locator Code for the Nairobi Youth Sports Organization and Information Centre in Kibera, Nairobi:

> (olc:lat/lon->olc -1.314121 36.798829 t)
"6GCRMQPX+9G4"

Get back the latitude and longitude of the Nairobi Youth Sports Organization and Information Centre in Kibera, Nairobi:

> (olc:olc->lat/lon "6GCRMQPX+9G4" t)
(-1.3141125000000042d0 36.798828125d0)

Tests

The tests require the fiveam library.

(asdf:test-system "olc")

About

Convert coordinates between Latitude/Longitude and Open Location Code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published