GeoKit gem sounds like the right fit for what you would like to do.
It abstracts interfaces with various geocoding services (Yahoo, Google, etc.) and provides code for calculating distances.
You can geocode zip files to obtain locations, access address-based location information, and calculate distances between your locations.
Here's a quick start, shameless, copied from the linked page to give you an idea of how the library works:
irb> require 'rubygems' irb> require 'geokit' irb> a=Geokit::Geocoders::YahooGeocoder.geocode '140 Market St, San Francisco, CA' irb> a.ll => 37.79363,-122.396116 irb> b=Geokit::Geocoders::YahooGeocoder.geocode '789 Geary St, San Francisco, CA' irb> b.ll => 37.786217,-122.41619 irb> a.distance_to(b) => 1.21120007413626 irb> a.heading_to(b) => 244.959832435678 irb(main):006:0> c=a.midpoint_to(b)
Jason jones
source share