Skip to content
Snippets Groups Projects
Commit 534c08bd authored by David Byers's avatar David Byers
Browse files

Renamed -geo to -compound.

parent 5e5d5ce9
No related branches found
Tags 1.3.0
No related merge requests found
2020-07-22 David Byers <david.byers@liu.se>
Rename some functions:
* olc.el (olc-shorten-compound): Renamed from olc-shorten-geo to
better match Google's terminology in their plus codes api.
(olc-recover-compound): Same.
Implement olc-shorten-geo and clean up:
* olc.el (olc-shorten-geo): New function.
(olc-encode): Use cl-defun and keyword args.
......
......@@ -64,6 +64,6 @@ Recovery using a geographical reference (requires `requests` and uses
the OpenStreetMap API):
````
(olc-recover-string "M24Q+89 Mutitjulu")
(olc-recover-compound "M24Q+89 Mutitjulu")
"5Q6HM24Q+89"
````
;;; olc.el --- Open location code library -*-coding: utf-8;-*-
;; -*-coding: utf-8;-*-
;;; olc.el --- Open location code library
;; Copyright (C) 2020 David Byers
;;
......@@ -434,7 +436,7 @@ shortened code, of if LIMIT is not positive and even."
code))))
(cl-defun olc-shorten-geo (code &key (limit 4) (zoom '(1 18)))
(cl-defun olc-shorten-compound (code &key (limit 4) (zoom '(1 18)))
"Attempt to shorten CODE with a geographic reference.
Shorten CODE, which must be a full open location code, finding a
......@@ -545,7 +547,7 @@ full open location code."
(olc-encode lat lon :len (olc-parse-precision parse)))))))
(cl-defun olc-recover-geo (arg1 &optional arg2 &key (format 'area))
(cl-defun olc-recover-compound (arg1 &optional arg2 &key (format 'area))
"Recover a location from a short code and reference.
When called with one argument, ARG1, it must be a string
......
......@@ -177,7 +177,7 @@ or shortened code, of if @var{limit} is not even.
@end example
@end defun
@defun olc-shorten-geo code &key limit
@defun olc-shorten-compound code &key limit
Shorten @var{code}, which must be a full open location code, finding a
reference near the encoded location. If @var{limit} is non-nil, then
the code will be shortened by at most that many digits. If the code
......@@ -194,13 +194,13 @@ shortened code, of if @var{limit} is not even.
@example
@group
(olc-shorten-geo "5Q6HM24Q+89")
(olc-shorten-compound "5Q6HM24Q+89")
@result{} "M24Q+89 Mutitjulu, Northern Territory, Australia"
(olc-shorten-geo "5Q6HM24Q+89" :limit 2)
(olc-shorten-compound "5Q6HM24Q+89" :limit 2)
@result{} "6HM24Q+89 Northern Territory, Australia"
(olc-shorten-geo "5Q6HM24Q+89" :zoom 14)
(olc-shorten-compound "5Q6HM24Q+89" :zoom 14)
@result{} "M24Q+89 Mutitjulu, Northern Territory, Australia"
(olc-shorten-geo "5Q6HM24Q+89" :zoom 1)
(olc-shorten-compound "5Q6HM24Q+89" :zoom 1)
"6HM24Q+89 Australia"
@end group
@end example
......@@ -223,7 +223,7 @@ value), the returned value is an full open location code.
@end example
@end defun
@defun olc-recover-geo arg1 &optional arg2 &key format
@defun olc-recover-compound arg1 &optional arg2 &key format
Recover a shortened code @i{without} the reference latitude and
longitude.
......@@ -240,11 +240,11 @@ details).
@example
@group
(olc-recover-geo "M24Q+89 Mutitjulu")
(olc-recover-compound "M24Q+89 Mutitjulu")
@result{} "5Q6HM24Q+89"
(olc-recover-geo "M24Q+89" "Mutitjulu")
(olc-recover-compound "M24Q+89" "Mutitjulu")
@result{} "5Q6HM24Q+89"
(olc-recover-geo "M24Q+89" "Mutitjulu" :format 'latlon)
(olc-recover-compound "M24Q+89" "Mutitjulu" :format 'latlon)
@result{} (-25.344187500000004 . 131.0384375)
@end group
@end example
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment