Using Bing option with taRifx.geo in R

穿精又带淫゛_ 提交于 2019-12-11 01:29:25

问题


I'm attempting to find the coordinates for several cities in Ghana. I've used the geocode function in taRifx.geo with the "google" option and had success, but Google doesn't know where all my cities are.

I'd like to use the Bing service to fill in the coordinates that were missing from my Google list and I'm starting with just one city ("Awutu Breku") to make sure the code works. I run this code, though, and get an error:

 > Bkey <- "______________(my key would be here)____"

 > Loc5 <- geocode("Awutu Breku", service="bing", BingMapsKey = Bkey,
 +                 returntype="coordinates")
 Error in geocode.default("Awutu Breku", service = "bing", BingMapsKey = Bkey,  : 
   To use Bing, you must save your Bing Maps API key (obtain at      http://msdn.microsoft.com/en-us/library/ff428642.aspx) using options(BingMapsKey='mykey').

This error is very confusing since I do include the BingMapsKey argument but the function doesn't seem to be recognizing it.

I've searched quite a bit for an answer to this one and haven't come across anything. I even looked on the github page but couldn't figure out what might be wrong with my code. I feel like I'm missing something simple. Any help would be appreciated!


回答1:


I needed to do a devtools::install_github("gsk3/taRifx.geo") to be able to use the geocode function and the instructions clearly state that you need to do a:

options(BingMapsKey='ridiculously_long_string')

before calling using the bing option:

geocode("1600 Pennsylvania Ave NW, Washington, DC 20500", service="bing")

## [1]  38.89719 -77.03655


来源:https://stackoverflow.com/questions/26075811/using-bing-option-with-tarifx-geo-in-r

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!