Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does geocode keep returning the wrong address but Google Maps works correctly

I'm in the New Orleans area. When I open Google Maps in the New Orleans area and then search for "Council on Alcohol & Drug", I get the correct location with coordinates (longitude = -90.09, latitude = 29.96).

enter image description here

Yet, when I use the geocode method from ggmap, I keep getting some other coordinates not even in New Orleans. I've tried a number of tricks to get this to work but still haven't found a solution.

library(ggmap)
geocode(location="Council on Alcohol & Drug") # NA NA
geocode(location="Council on Alcohol & Drug New Orleans") # NA NA
geocode(location="Council on Alcohol & Drug&components=administrative_area:Louisiana") # -91.96 30.98
geocode(location="Council on Alcohol & Drug&components=administrative_area:New Orleans") # NA NA
geocode(location="Council on Alcohol & Drug&region=New Orleans") # NA NA

geocode seems squirrely for me in general. Any advice on getting it to behave?

like image 320
Ben Avatar asked Jul 23 '15 23:07

Ben


1 Answers

Converting the "&" to "and" corrected the problem. (Solved it as I was typing my question and figured it'd still be worth posting.)

like image 150
Ben Avatar answered Sep 30 '22 04:09

Ben