A Clojure library for various geocoder services.
Clojure Shell
Switch branches/tags
Nothing to show
Pull request Compare This branch is 91 commits behind r0man:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src/geocoder
test/geocoder/test
.gitignore
README
maxmind.sh
project.clj

README

# GEOCODE-CLJ

A Clojure library for various geocoder services.

## Installation

Via Clojars: http://clojars.org/geocoder-clj

## Usage

(use 'geocoder.core)

(geocode "Senefelderstraße 24, 10437 Berlin")
;=> ({:country {:name "Germany", :iso-3166-1-alpha-2 "de"},
;=>   :city "Berlin",
;=>   :location {:latitude 52.54258, :longitude 13.42299},
;=>   :street-name "Senefelderstraße",
;=>   :street-number "24",
;=>   :postal-code "10437",
;=>   :region "Berlin"})

(reverse-geocode {:latitude 52.54258, :longitude 13.42299})
;=> ({:country {:name "Germany", :iso-3166-1-alpha-2 "de"},
;=>   :city "Berlin",
;=>   :location {:latitude 52.54258, :longitude 13.42299},
;=>   :street-name "Senefelderstraße",
;=>   :street-number "24",
;=>   :postal-code "10437",
;=>   :region "Berlin"})

(use 'geocoder.maxmind)

(with-maxmind "GeoLiteCity.dat"
  (geocode-ip "92.229.192.11"))
;=> {:country {:name "Germany", :iso-3166-1-alpha-2 "de"},
;=>  :region {:id "16"},
;=>  :city "Berlin",
;=>  :location {:latitude 52.516693115234375, :longitude 13.399993896484375},
;=>  :area-code 0,
;=>  :dma-code 0,
;=>  :metro-code 0}

## License

Copyright (C) 2011 Roman Scherer

Distributed under the Eclipse Public License, the same as Clojure.