Shandy Nantz wrote:
> I am trying to write a script that uses the rails-geocoder gem to grab
> the latitude and longitude so I can store those values in my own local
> table, but am having trouble getting anything to work or to find any
> decent documentation describing or even helping me accomplish what I
> need done. Does anybody have any suggestions? I have found this example:
> http://geocoder.rubyforge.org/ that seems pretty straight forward. I
> have a list of cities and states and am just trying to loop through each
> and get the lat lon values. Thanks,
> 
> -S

I think that geocoder is for full addresses. For just cities, you could 
use worldkit. Sending a request like so:
http://brainoff.com/worldkit/geocoder/rest/?city=San+Diego,CA,US

will get you a response like this with the lat & long for the city:
<rdf:RDF>
  <geo:Point>
    <geo:long>-117.191848</geo:long>
    <geo:lat>32.751575</geo:lat>
  </geo:Point>
</rdf:RDF>

You have to make sure there are no spaces in the city field. So cycling 
through your list of cities, you'd make sure to concatenate multi word 
cities with a '+' before sending the request.
-- 
Posted via http://www.ruby-forum.com/.