Sunday, 14 December 2008

Geokit geocoding with multiple matches

« Posting a file with ActiveResource | Main | Html view plugin for dijit.Editor »

Do you want to be able to manage multiple geocoding matches with Geokit?

>> g = Geokit::Geocoders::GoogleGeocoder.geocode('Springfield')
=> #<Geokit::GeoLocs:0x7f0705acb288 ...
>> g.full_address
=> "Springfield, MO, USA"
>> g.ll
=> "37.196828,-93.287061"
>> g.size
=> 9
>> g.map {|e| e.full_address}
=> ["Springfield, MO, USA", "Springfield, Florida, USA", "Springfield, IL, USA", "Springfield, Missouri, USA", "Springfield, MA, USA", "Springfield, Virginia, USA", "Springfield, OH, USA", "Springfield Ave, Paris, IL 61944, USA", "Springfield, Baldwin, MI 49304, USA"]
>> g.is_a? Geokit::GeoLoc
=> true

Give a try to my simple enhancement (only for Google geocoder) and let me know.

Technorati Tags:

Posted by Nicola Piccinini at 4:40 PM CET in /

Comments on this entry:

Left by nofxx at 15 Feb 11:26 PM

Hello Nicola,

My name is "Marcos Piccinini" , working with ruby/gis here in Brazil.... (coincidence?? hehe)

Just found your blog somehow. Add me up on yr IM if you wish.