I have a table of address in my database. I want to show these on a google map. The problem is, I can only get it to work if I have a pretty geocode like this: ''555 Irving, San Francisco, CA'',Irving'' and my data is not compatible with this format, as it formatted like this: "Tsukuba, Japan". How can I look up an address like "Tsukuba, Japan", and get a geocode I can use for a Google Maps lookup? My code for looking up places so far looks like this (I had to hardcode "places" to get it to work) def show places = [ {:address=>''555 Irving, San Francisco, CA'',:description=>''Irving''} ] # this loop will do the geo lookup for each place places.each do |place| # get the geocode by calling our own get_geocode(address) method place.merge! get_geocode(place[:address]) end #place the result in the session so we can use it for display session[:places] = places end def show_google_map # all we''re going to do is loop through the @places array on the page @places=session[:places] end private def get_geocode(address) logger.debug ''starting geocoder call for address: ''+address # this is where we call the geocoding web service server XMLRPC::Client.new2(''http://rpc.geocoder.us/service/xmlrpc'') result = server.call2(''geocode'', address) logger.debug "Geocode call: "+result.inspect return {:success=> true, :latitude=> result[1][0][''lat''], :longitude=> result[1][0][''long'']} end -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---