GeoCoding using Ruby

A quick hack to get a location's geo coding

 
 require 'xml-simple'
 require 'net/http'
 
 # Enter the location to get the lat and long
 #
 def yahoo_geo(location)
   host = "api.local.yahoo.com"
   q =  "http://api.local.yahoo.com/MapsService/V1/geocode"
   q << "?appid=wnorrix&location=#{URI.encode(location)}"
   xml = XmlSimple.xml_in(Net::HTTP.get(host, q), {"ForceArray" => false})
   return xml["Result"]
 end
 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I'm missing rails :(

Aw Man Warren,

Looking at your blog, you're reminding me how much I miss ruby on rails (now in php/ajax/perl hell)...

My kingdom for a decent hash/associative array library, grr!!!

...Rodney

Post new comment

The content of this field is kept private and will not be shown publicly.