Created
May 12, 2012 04:17
-
-
Save eightysteele/2664108 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Map of lat/lon min and max values. | |
(def latlon-range {:lat-min -90 :lat-max 90 :lon-min -180 :lon-max 180}) | |
(defn latlon-valid? [lat lon] | |
"Returns true if lat and lon are valid, otherwise returns false." | |
(let [{:keys [lat-min lat-max lon-min lon-max]} latlon-range] | |
(and (<= lat lat-max) | |
(>= lat lat-min) | |
(<= lon lon-max) | |
(>= lon lon-min)))) | |
(defn latlon->tile | |
[lat lon zoom] | |
"Returns tile [x y zoom] corresponding to a lat/lon at the given zoom." | |
(let [{:keys [x y zoom]} (get-maptile (Alert. lat lon zoom))] | |
[x y zoom])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment