gchart_generate_countries {gchartsmap} | R Documentation |
Generate Google Charts spatial data for all countries
Description
This function queries 'Google Charts' resources to identify countries for which geographical data is available, and generates the simple features for local use.
Usage
gchart_generate_countries(
countries = "all",
server = "https://www.gstatic.com/charts/geochart/10/mapfiles/",
cache = gchart_get_cache_path(),
verbose = TRUE
)
Arguments
countries |
Which countries to process. Defaults to "all".
Use country codes from |
server |
Google geochart server to access. |
cache |
Path to store downloaded data. |
verbose |
Whether to show messages during processing. |
Value
Returns a simple features 'data.frame' with class 'sf', representing the spatial data for all countries from the Google Charts servers, using the WGS84 (epsg = 4326) coordinate reference system. You need to first run 'gchart_set_cache()' so the package knows where to store the downloaded data.
Examples
library(package = "gchartsmap")
# set the cache path to your system's cache path
gchartsmap::gchart_set_cache(path = tempdir())
# GET and process all countries
gchartsmap::gchart_generate_countries(countries = "GT")
# clean up
list.files(
tempdir(), all.files = TRUE, full.names = TRUE, recursive = TRUE
)
[Package gchartsmap version 1.0.1 Index]