Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

百度地图JavaScript API升级后要更新getBaiduMap.R,getCoordinate.R,getLocation.R,getRoute.R四个文件中调用百度地图服务的URL #23

Open
icejean opened this issue Jan 16, 2022 · 0 comments

Comments

@icejean
Copy link

icejean commented Jan 16, 2022

#install_github('badbye/baidumap')

#百度地图JavaScript API升级后要更新getBaiduMap.R,getCoordinate.R,getLocation.R,getRoute.R四个文件中调用百度地图服务的URL
#然后打开命令行窗口用下面的命令重新打包成baidumap_0.2.2.tar.gz再安装

cd D:\software\R\Rsources\badbye-baidumap-bea3930

Rcmd build badbye-baidumap-bea3930

#当前为V3.0版本接口文档,V2.0及以前版本自2019.6.18起新用户无法使用。
#老用户仍可继续使用V2.0及以前版本请求实现逆地理编码服务,为保障用户体验,建议您尽快迁移到V3.0版本。

#改动:
#getBaiduMap.R
#改为下面,新版本已经没有coordtype参数,URL也变了

set url

url_head = "http://api.map.baidu.com/staticimage/v2?"
url = paste0(url_head, "width=", width, "&height=", height, "&center=",
lon, ",", lat, "&zoom=", zoom,"&ak=",map_ak)
if (scale == 2) url = paste0(url, "&scale=2")
#getCoordinate.R:

url_head = paste0('http://api.map.baidu.com/geocoder/v2/?address=', address)

#改为
url_head = paste0('http://api.map.baidu.com/geocoding/v3/?address=', address)
#getLocation.R:

url_head = paste0("http://api.map.baidu.com/geocoder/v2/?ak=", map_ak, "&location=")

#改为
url_head = paste0("http://api.map.baidu.com/reverse_geocoding/v3/?ak=", map_ak, "&location=")
#getRoute.R:

serverAddress = 'http://api.map.baidu.com/direction/v1'

#改为
serverAddress = 'http://api.map.baidu.com/direction/v2/driving'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant