Announcing Graticule geocoding API
update: Graticule is now hosted on Rubyforge.
Graticule is a geocoding API for interpolating address data into geographic coordinates written in Ruby. The goal is to provide a consistent interface into the various geocoding services, allowing other libraries to be built on top of them while remaining agnostic of the specific service that is being used.
In its current state, Graticule is just a repackaging of the different gems produced by Eric Hodel of Robot Co-op. It currently supports the Yahoo, Google, Geocoder.us, and MetaCarta APIs. The plan is to expand upon them.
Usage
You can grab the gem or check out the code from Subversion. The Rdoc is also available.
require 'rubygems' require 'graticule' geocoder = Graticule.service(:google).new "api_key" location = geocoder.locate "1600 Amphitheatre Parkway, Mountain View, CA"
Feedback
I’d love to get your feedback. There are a few places where the API is still not consistent (e.g. Yahoo returns multiple results). I’d also appreciate any help with packaging and releasing as I am a newbie at creating Gems.
1 Comment
First of all, Thanks for this great plugin! in cleans up a lot of my code!
I found a small bug in the way geocoder.locate works. It calls Graticule::Location.to_s to get the formatted string to send to the geocoding service (I only tested the google service).
The problem is that the to_s method insert a \n into the string, which makes the google geocoder hiccup with certain geocoding queries and give you geodata (my example was :street => ‘Kampstraße 4’ , :zipcode => ‘20357’, :locality => ‘Hamburg’, :country => ‘DE’). Changeing the to_s method to the following solves the problem:
Kind regards,
Andy Nahapetian
link: nahapetian.com
Post a Comment