Commits

Ning Sun  committed 75c180a

update readme, fix decode-bbox bug

  • Participants
  • Parent commits 8205034
  • Tags v1.0.1

Comments (0)

Files changed (4)

File README

-# geohash
-
-FIXME: write description
-
-## Usage
-
-FIXME: write
-
-## License
-
-Copyright (C) 2011 FIXME
-
-Distributed under the Eclipse Public License, the same as Clojure.
+# geohash
+
+[Geohash](http://en.wikipedia.org/wiki/Geohash "geohash") library for clojure.
+
+## Usage
+
+Include geohash with leiningen:
+
+    (defproject your-project "1.0.0-SNAPSHOT"
+        :dependencies [[org.clojars.sunng/geohash "1.0.0"]])
+        
+Encode coordinate into geohash:
+
+    (use [geohash.core])
+    (encode 37.8324 112.5584 9)
+    "ww8p1r4t8"
+    
+Decode geohash into coordinate:
+
+    (decode "ww8p1r4t8")
+    {:lat 37.83238649368286,
+     :lon 112.55838632583618,
+     :lat-err 2.1457672119140625E-5,
+     :lon-err 2.1457672119140625E-5}
+    
+Decode geohash into bound box:
+
+    (decode-bbox "ww8p1r4t8")
+    {:minlon 112.55836486816406,
+     :maxlon 112.5584077835083,
+     :minlat 37.83236503601074,
+     :maxlat 37.83240795135498}       
+
+## License
+
+Copyright (C) 2011 Sun Ning <classicning@gmail.com>
+
+Distributed under the Eclipse Public License, the same as Clojure.
-(defproject org.clojars.sunng/geohash "1.0.0"
+(defproject org.clojars.sunng/geohash "1.0.1"
   :description "Geohash in clojure"
   :dependencies [[org.clojure/clojure "1.2.1"]]
   :dev-dependencies [[lein-clojars "0.6.0"]])

File src/geohash/core.clj

   (let [
         hashcodes (map base32-index hashstring)
         bbox (do-decode-bbox hashcodes (struct geocode-data 180.0 -180.0 90.0 -90.0 true nil nil nil))]
-    (dissoc bbox :islon :bits :hashcode :hashstring)))
+    {
+      :minlon (:minlon bbox)
+      :maxlon (:maxlon bbox)
+      :minlat (:minlat bbox)
+      :maxlat (:maxlat bbox)}))
 
 (defn decode [hashstring]
   (let [