library(rjson)
library(RCurl)
gaode_key<-'***'
##新写的反地理位置编码
### 地理编码函数get_Geocode(店址,城市,密钥)
get_Geocode<-function(address='¥¥¥',city=NULL,key=gaode_key){
address = URLencode(enc2utf8(address))
url_head = 'https://restapi.amap.com/v3/geocode/geo?key='
api_url = sprintf('%s%s&output=json&address=%s',
url_head, gaode_key, address)
result = getURL(api_url)
result = fromJSON(result)
loc=result$geocodes[[1]]$location
return(loc)
}
get_POI<-function(keywords = NULL,address='汤臣金融大厦',city = NULL,loc,types=NULL,r = 1000,offset = 20,page = NULL,key=gaode_key,verbose = TRUE){
loc = get_Geocode(address = address, city = city, key = gaode_key)
loc = as.character(loc)
if(mode(keywords) != 'NULL'){
keywords = URLencode(enc2u
R语言连接高德之getPOI函数
最新推荐文章于 2024-01-30 09:20:52 发布