楼主: duxueyuan
7660 6

[实际应用] R语言baidumap中getCoordinate()函数返回值NA [推广有奖]

  • 0关注
  • 0粉丝

大专生

46%

还不是VIP/贵宾

-

威望
0
论坛币
253 个
通用积分
1.0870
学术水平
5 点
热心指数
5 点
信用等级
4 点
经验
366 点
帖子
23
精华
0
在线时间
57 小时
注册时间
2011-2-21
最后登录
2022-2-9

50论坛币
本人打算使用R的baidumap批量获取地址的经纬度。
参考网上的一个帖子:https://blog.csdn.net/lotterychampion/article/details/51404364。
一步一步比照操作,如下是本人的代码和结果:
>library(devtools)
>library(baidumap)
>options(baidumap.key=‘’DumE765pGiZiv35iTlSnGbBDdD7FkODx’)      #----服务器端AK
>options(baidumap.key = 'mg32pGMYP0aoWikhZ7pdGg4MoHtWoi97') #----浏览器端AK

> getCoordinate('北京大学') # json
   北京大学 "{\"status\":240,\"message\":\"APP <e6><9c><8d><e5><8a><a1>è¢<ab><e7>|

>getCoordinate('北京大学', formatted = T) # character
Warning messages:
1: In trans(result) : NAs introduced by coercion
2: In trans(result) : NAs introduced by coercion

搜尽了百度的相关帖子,也有网友针对这个问题提出问题,但没有直接回答。本人认为可能是存在两种原因:
1.申请的AK有问题。本人通过查看“status\":240,\"message\":\"APP ”这个解释:服务被禁用。
2.本人分析可能是在baidumap这个包安装过程中存在问题,导致运行的时候出错。

下面的代码是本人在安装完baidumap,rstudio给出的提示:
The downloaded binary packages are in
        C:\Users\Administrator\AppData\Local\Temp\Rtmp4U1T6w\downloaded_packages
WARNING: Rtools is required to build R packages, but is not currently installed.

Please download and install Rtools 3.5 from http://cran.r-

project.org/bin/windows/Rtools/.
√  checking for file 'C:\Users\Administrator\AppData\Local\Temp\Rtmp4U1T6w

\remotes18a84b6f4a63\badbye-baidumap-bea3930/DESCRIPTION' (1s)
-  preparing 'baidumap':
√  checking DESCRIPTION meta-information ...
-  checking for LF line-endings in source and make files and shell scripts
-  checking for empty or unneeded directories
-  building 'baidumap_0.2.2.tar.gz'
   
* installing *source* package 'baidumap' ...
** using staged installation
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
  converting help for package 'baidumap'
    finding HTML links ... 好了
    geoconv                                 html  
    getBaiduMap                             html  
    getCoordinate                           html  
    getLocation                             html  
    getPlace                                html  
    getRoute                                html  
    url_character                           html  
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (baidumap)
Warning messages:
1: In untar2(tarfile, files, list, exdir) :
  skipping pax global extended headers
2: In untar2(tarfile, files, list, exdir) :
  skipping pax global extended headers
本人根据提示,安装了Rtools,也没见啥效果。
恳求使用baidumap的大神们,帮我指点一下,可以用本人的AK验证一下,是否是AK的问题,还是包的问题!不胜感激!

关键词:baidumap getCoordinate
沙发
duxueyuan 在职认证  发表于 2019-7-29 16:56:36 |只看作者 |坛友微信交流群
这个问题我本人今天解决了,还是百度AK的问题,我在网上找了几个有效的AK,代码就可以执行了!

使用道具

藤椅
duxueyuan 在职认证  发表于 2019-7-31 13:33:22 |只看作者 |坛友微信交流群
问题解决了!

使用道具

板凳
zhaozinong 发表于 2019-8-20 14:50:07 |只看作者 |坛友微信交流群
您好!能分享一下有效的AK么?或者哪里去找,找了很多都用不了。谢谢您

使用道具

报纸
哲语川川 在职认证  发表于 2019-10-5 10:11:08 |只看作者 |坛友微信交流群
duxueyuan 发表于 2019-7-31 13:33
问题解决了!
我也遇到了同样的问题,能讲一讲你的解决方案吗?

使用道具

地板
星空tcl 发表于 2021-9-23 22:15:08 |只看作者 |坛友微信交流群
您好,是不是必须要给配额充值才行呀?那提取经纬度,需要给地理编码充值还是给坐标转换充值呀?

使用道具

7
Roridodo 学生认证  发表于 2022-3-1 19:35:27 |只看作者 |坛友微信交流群
您好我也是这个问题,而且我的密钥用python运行时是可以获取信息的,但是r就显示禁用,这也是AK账户的问题吗?

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-5-1 00:28