Class: Graticule::Geocoder::Mapquest
- Defined in:
- lib/graticule/geocoder/mapquest.rb
Overview
Mapquest requires both a client id and a password, which you can get by registering at: developer.mapquest.com/Home/Register?_devAPISignup_WAR_devAPISignup_action=signup&_devAPISignup_WAR_devAPISignup_clientType=Developer
mq = Graticule.service(:mapquest).new(CLIENT_ID, PASSWORD) location = gg.locate(‘44 Allen Rd., Lovell, ME 04051’)
- 42.78942, -86.104424
Constant Summary collapse
- PRECISION =
I would link to the documentation here, but there is none that will do anything but confuse you.
{ 'L1' => :address, 'I1' => :street, 'B1' => :street, 'B2' => :street, 'B3' => :street, 'Z3' => :zip, 'Z4' => :zip, 'Z2' => :zip, 'Z1' => :zip, 'A5' => :city, 'A4' => :county, 'A3' => :state, 'A1' => :country }
Constants inherited from Base
Instance Method Summary collapse
-
#initialize(client_id, password) ⇒ Mapquest
constructor
A new instance of Mapquest.
-
#locate(address) ⇒ Object
Locates
address
returning a Location.
Constructor Details
#initialize(client_id, password) ⇒ Mapquest
Returns a new instance of Mapquest.
31 32 33 34 35 |
# File 'lib/graticule/geocoder/mapquest.rb', line 31 def initialize(client_id, password) @password = password @client_id = client_id @url = URI.parse('http://geocode.dev.mapquest.com/mq/mqserver.dll') end |
Instance Method Details
#locate(address) ⇒ Object
Locates address
returning a Location
38 39 40 |
# File 'lib/graticule/geocoder/mapquest.rb', line 38 def locate(address) get :q => address.is_a?(String) ? address : location_from_params(address).to_s end |