Skip to content

Instantly share code, notes, and snippets.

@eightysteele
Created May 12, 2012 04:17
Show Gist options
  • Save eightysteele/2664108 to your computer and use it in GitHub Desktop.
Save eightysteele/2664108 to your computer and use it in GitHub Desktop.
;; 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