Geocoding addresses with ym4r google maps


#1

Does anyone know how to geocode addresses using the YM4R Google Map
plug-in?


#2

Scott Pn wrote:

Does anyone know how to geocode addresses using the YM4R Google Map
plug-in?

Nevermind I found out how to do it.

require ‘net/http’
require ‘csv’
require ‘xmlrpc/client’

module Geocode
def geocode(input)
server =
XMLRPC::Client.new2(‘http://rpc.geocoder.us/service/xmlrpc’)
result = server.call2(‘geocode’, “#{input}”)

  return { :score => 0 } if result.nil? || result[0].nil?

  return {
    :latitude => result[1][0]['lat'],
    :longitude => result[1][0]['long'],
    :description => nil,
    :original_address => input
  }
end

end


#3

On 7/23/07, Scott Pn removed_email_address@domain.invalid wrote:

Does anyone know how to geocode addresses using the YM4R Google Map
plug-in?

It’s been a while but I know it’s in the docs. Also, google rate
limits lookups to around 1 every 2 seconds. If you go over that for
any period of time they block your ip.

Chris


#4

snacktime wrote:

On 7/23/07, Scott Pn removed_email_address@domain.invalid wrote:

Does anyone know how to geocode addresses using the YM4R Google Map
plug-in?

It’s been a while but I know it’s in the docs. Also, google rate
limits lookups to around 1 every 2 seconds. If you go over that for
any period of time they block your ip.

Chris

Yeah I realize that, and that is why I am using
http://rpc.geocoder.us/service/xmlrpc instead.

And for reference to anyone who comes by this thread, I think you can
buy more “geocode references” from google and yahoo for a fee :frowning: