Learn R Programming

eurostat (version 3.2.2)

get_eurostat_geospatial: Download Geospatial Data from GISGO

Description

Downloads either a simple features (sf), SpatialPolygonDataFrame or a data_frame preprocessed using broom::tidy().

Usage

get_eurostat_geospatial(output_class = "sf", resolution = "60",
  nuts_level = "all", year = "2013", cache = TRUE, update_cache = FALSE,
  cache_dir = NULL)

Arguments

output_class

A string. Class of object returned, either sf simple features, df (data_frame) or spdf (SpatialPolygonDataFrame)

resolution

Resolution of the geospatial data. One of "60" (1:60million), "20" (1:20million), "10" (1:10million), "03" (1:3million) or "01" (1:1million).

nuts_level

Level of NUTS classification of the geospatial data. One of "0", "1", "2", "3" or "all" (mimics the original behaviour)

year

NUTS release year. One of "2003", "2006", "2010", "2013"

cache

a logical whether to do caching. Default is TRUE. Affects only queries from the bulk download facility.

update_cache

a locigal whether to update cache. Can be set also with options(eurostat_update = TRUE)

cache_dir

a path to a cache directory. The directory have to exist. The NULL (default) uses and creates 'eurostat' directory in the temporary directory from tempdir. Directory can also be set with option eurostat_cache_dir.

Value

a sf, data_frame or SpatialPolygonDataFrame.

Details

The data source URL is http://ec.europa.eu/eurostat/web/gisco/geodata/reference-data/administrative-units-statistical-units.

Examples

Run this code
# NOT RUN {
 
# }
# NOT RUN {
   lp <- get_eurostat_geospatial(output_class = "sf", resolution = "60", nuts_level = "all")
   lp %>%  select(NUTS_ID) %>%  plot()
   lp <- get_eurostat_geospatial(output_class = "spdf", resolution = "60", nuts_level = "all")
   spplot(lp, "STAT_LEVL_")
   # or
   lp <- get_eurostat_geospatial(output_class = "df", resolution = "60", nuts_level = "all")
   ggplot(lp, aes(x=long,y=lat,group=group,fill=STAT_LEVL_),color="white") + geom_polygon()
 
# }
# NOT RUN {
 
# }

Run the code above in your browser using DataLab