bmap_get_location: Get Location for a Vector of lat/lon coordinates.

Description Usage Arguments Value Examples

View source: R/get_location.R

Description

Takes a vector of lat/lon coordinates, or a list of lat/lon coordinates, sends them to the Baidu Maps API, output a char vector of addresses and address component info, as json text objects. This function also implements a data dictionary, saved as an rda object, to avoid sending the same query to Baidu twice.

Usage

1
2
bmap_get_location(lat, lon, type = c("data.frame", "json"),
  force = FALSE, cache_chunk_size = NULL)

Arguments

lat

numeric vector, vector of latitude values.

lon

numeric vector, vector of longitude values.

type

string, dictates the return data type. Valid inputs are data.frame, which will return a data.frame, or json, which will return a vector of json strings.

force

logical, force online query, even if previously downloaded and saved to the data dictionary.

cache_chunk_size

integer, indicates how often you want the API return data to be saved to the package cache. Default value is NULL.

Value

char vector of json text objects. Each object contains the return value(s) from the Baidu Maps query, as well as the return value status code.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
lat <- c(
  30.616167082550779, 
  30.39624844375698, 
  30.679942845419565
)

lon <- c(
  114.27287244473057, 
  119.87833669326516, 
  104.06792346330406
)

bmap_get_location(lat, lon)

## End(Not run)

ChrisMuir/baidugeo documentation built on Feb. 7, 2020, 5 p.m.