getLocation: Get location from coordinate Take in coordiantes and return...

Description Usage Arguments Value Examples

View source: R/getLocation.R

Description

Get location from coordinate Take in coordiantes and return the location

Usage

1
2
getLocation(location, output = "json", formatted = F, pois = 0,
  limit = 600)

Arguments

location

longtitude and latitude

output

should be "json" or "xml", the type of the result

formatted

logical. whether to return a nice result

pois

whether to return the POI around the location

limit

integer value.If the number of row exceeded limit, function will run in parallel

Value

the corresponding locations

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## 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) 

## End(Not run)

badbye/baidumap documentation built on June 4, 2017, 12:12 a.m.