Over at Earthcode, a request was made to enable the distance_between and distance_to methods to accept physical locations in pre-geocoded string form. I have added this improvement, so you can now do:
1 2 3 4 5 6 7 |
# Geocode from and to, then calculate the distance # between them. dist = Store.distance_between("Irving, TX", "San Francisco, CA") # Geocode the to, then calculate the distance to it. dist = irving.distance_to("San Francisco, CA") |
Andre has also added further flexibility to the
rigin to include setting it to an array of lat / lng values. Usage looks like:
1 2 3 |
# Presumably some previous geocoding and then this: stores = Store.find(:all, |
Keep the feedback coming!
Are these changes in the .zip download at https://rubyforge.org/projects/geokit/ ?
Could you clarify for a newbie where I should save the geokit files in my ruby directory — I presume at something like c:\ruby\lib\ruby\gems\1.8\gems ?
Thanks for any guidance that would help me be able to play with geokit as Andre does at http://earthcode.com/blog/2007/02/database_distance_calculations.html
Regards,
Bernie
Sure. Its a plugin, so you need to follow the standard plugin script protocol. This varies slightly depending upon whether you run under Windows or Mac OSX.
Try this:
ruby script/plugin install svn://rubyforge.org/var/svn/geokit/trunk
Pingback: Web 2.0 Technologies