# NOT RUN {
# }
# NOT RUN {
## get one location
location_one = getLocation(c(118.12845, 24.57742))
## vectorization
loc = matrix(c(117.93780, 24.55730, 117.93291, 24.57745, 117.23530, 24.64210, 117.05890, 24.74860), byrow=T, ncol=2)
### json
location_json = getLocation(loc, output='json')
### get district
library(rjson)
getDistrict = function(x_json){
x_list = fromJSON(x_json)
x_list$result$addressComponent$district
}
location_district = sapply(location_json, getDistrict)
### xml
location_xml = getLocation(loc, output='xml')
## formatted
location = getLocation(loc, formatted = T)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab