Skip to content

Instantly share code, notes, and snippets.

@nglx
Forked from bjallen/gist:3723463
Created September 26, 2012 12:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nglx/3787676 to your computer and use it in GitHub Desktop.
Save nglx/3787676 to your computer and use it in GitHub Desktop.
city impact on results
# see what the confidence code means here:
# http://www.mapquestapi.com/geocoding/geocodequality.html
Web::Address.from_params({ :street => "Canal Road", :city => "Orleans", :state => "MA", :country => "US" })
[{"country_name"=>"United States",
"city"=>"Orleans",
"@name"=>"location",
"latitude"=>41.796795,
"country"=>"US",
"one_line_description"=>"[1-41] Canal Rd, Orleans, MA",
"postal_code"=>"02653",
"confidence_code"=>"B1AAA",
"map_url"=>
"http://www.mapquestapi.com/staticmap/v3/getmap?type=map&size=225,160&pois=purple-1,41.796795,-69.98574,0,0|&center=41.796795,-69.98574&zoom=12&key=Gmjtd|lu6y2l6bnd,as=o5-lwa0q&rand=1123949541",
"county"=>"Barnstable County",
"street"=>"[1-41] Canal Rd",
"exact_match"=>false,
"longitude"=>-69.98574,
"traffic"=>{"covered"=>false},
"state"=>"MA"}]
Request (with city):
street - not blank
city - not blank
state - not blank
country - not blank
Response:
street - not blank
city - not blank
state - not blank
country - not blank
Because
req.street.blank? == resp.street.blank? &&
req.city.blank? == resp.city.blank? &&
req.state.blank? == resp.state.blank? &&
req.country.blank? == resp.country.blank?
== true
skip presenting disambiguation
Web::Address.from_params({ :street => "Canal Road", :state => "MA", :country => "US" })
[{"country_name"=>"United States",
"city"=>"",
"@name"=>"location",
"latitude"=>42.173931,
"country"=>"US",
"one_line_description"=>"United States",
"postal_code"=>"",
"confidence_code"=>"A3XAX",
"map_url"=>
"http://www.mapquestapi.com/staticmap/v3/getmap?type=map&size=225,160&pois=purple-1,42.173931,-71.185501,0,0|&center=42.173931,-71.185501&zoom=3&key=Gmjtd|lu6y2l6bnd,as=o5-lwa0q&rand=-1255768379",
"county"=>"",
"street"=>"",
"exact_match"=>false,
"longitude"=>-71.185501,
"traffic"=>{"covered"=>false},
"state"=>"MA"}]
Request (without city):
street - not blank
city - blank
state - not blank
country - not blank
Response:
street - blank
city - blank
state - not blank
country - not blank
Because
req.street.blank? == resp.street.blank? &&
req.city.blank? == resp.city.blank? &&
req.state.blank? == resp.state.blank? &&
req.country.blank? == resp.country.blank?
== false
present disambiguation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment