maidenhead
2024-10-12
Convert coordinates between Latitude/Longitude and Maidenhead.
maidenhead
This is a Common Lisp library to convert coordinates between Latitude/Longitude and Maidenhead locator system.
1API
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->maidenhead latitude longitude) -> string
Return the Maidenhead locator for the given latitude and longitude.
(maidenhead->lat/lon locator &optional center-p) -> list
Return the latitude and longitude for the southwest corner of the given
Maidenhead locator square, or the center of the square if center-p is
not nil
.
2Examples
Load the library:
> (asdf:load-system "maidenhead")
...
Get the Maidenhead locator of Munich:
> (maidenhead:lat/lon->maidenhead 48.14666 11.60833)
"JN58TD25"
Get back the latitude and longitude of Munich:
> (maidenhead:maidenhead->lat/lon "JN58TD25" t)
(48.147916666666674d0 11.60416666666666d0)
3Tests
The tests require the fiveam library.
(asdf:test-system "maidenhead")