Title: | Download Map Data from GISCO API - Eurostat |
---|---|
Description: | Tools to download data from the GISCO (Geographic Information System of the Commission) Eurostat database <https://ec.europa.eu/eurostat/web/gisco>. Global and European map data available. This package is in no way officially related to or endorsed by Eurostat. |
Authors: | Diego Hernangómez [aut, cre, cph] (<https://orcid.org/0000-0001-8457-4658>, rOpenGov), EuroGeographics [cph] (for the administrative boundaries.), Vincent Arel-Bundock [cph] (<https://orcid.org/0000-0003-2042-7063>, for the gisco_countrycode dataset.) |
Maintainer: | Diego Hernangómez <[email protected]> |
License: | GPL-3 |
Version: | 0.3.5.9000 |
Built: | 2023-09-12 20:09:11 UTC |
Source: | https://github.com/rOpenGov/giscoR |
Get the legal text to be used along with the data downloaded with this package
gisco_attributions(lang = "en", copyright = FALSE)
lang |
Language (two-letter ISO code). See https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes and Details. |
copyright |
Boolean. Whether to display the copyright notice or not on the console. |
Current languages supported are:
"en" - English
"da" - Danish
"de" - German
"es" - Spanish
"fi" - Finish
"fr" - French
"no" - Norwegian
"sv" - Swedish
Please consider contributing if you spot any mistake or want to add a new language.
A string with the attribution to be used.
COPYRIGHT NOTICE
When data downloaded from GISCO is used in any printed or electronic publication, in addition to any other provisions applicable to the whole Eurostat website, data source will have to be acknowledged in the legend of the map and in the introductory page of the publication with the following copyright notice:
EN: (C) EuroGeographics for the administrative boundaries
FR: (C) EuroGeographics pour les limites administratives
DE: (C) EuroGeographics bezuglich der Verwaltungsgrenzen
For publications in languages other than English, French or German, the translation of the copyright notice in the language of the publication shall be used.
If you intend to use the data commercially, please contact EuroGeographics for information regarding their licence agreements.
gisco_attributions()
gisco_attributions(lang = "es", copyright = TRUE)
gisco_attributions(lang = "XXX")
Downloads zipped data from GISCO and extract them on the cache_dir
folder.
gisco_bulk_download(
id_giscoR = c("countries", "coastallines", "communes", "lau", "nuts", "urban_audit"),
year = "2016",
cache_dir = NULL,
update_cache = FALSE,
verbose = FALSE,
resolution = "10",
ext = c("geojson", "shp", "svg", "json", "gdb"),
recursive = TRUE
)
id_giscoR |
Type of dataset to be downloaded. Values supported are:
|
year |
Release year of the file. See Details |
cache_dir |
A path to a cache directory. See About caching. |
update_cache |
A logical whether to update cache. Default is |
verbose |
Logical, displays information. Useful for debugging,
default is |
resolution |
Resolution of the geospatial data. One of
|
ext |
Extension of the file(s) to be downloaded. Formats available are "geojson", "shp", "svg", "json", "gdb". See Details. |
recursive |
Tries to unzip recursively the zip files (if any) included
in the initial bulk download (case of |
See the years available in the corresponding functions:
The usual extension used across giscoR is "geojson", however other formats are already available on GISCO.
Silent function.
You can set your cache_dir
with gisco_set_cache_dir()
.
Sometimes cached files may be corrupt. On that case, try re-downloading
the data setting update_cache = TRUE
.
If you experience any problem on download, try to download the
corresponding .geojson file by any other method and save it on your
cache_dir
. Use the option verbose = TRUE
for debugging the API query.
For a complete list of files available check gisco_db.
https://gisco-services.ec.europa.eu/distribution/v2/
Other political:
gisco_get_coastallines()
,
gisco_get_countries()
,
gisco_get_lau()
,
gisco_get_nuts()
,
gisco_get_postalcodes()
,
gisco_get_units()
,
gisco_get_urban_audit()
## Not run:
# Countries 2016 - It would take some time
gisco_bulk_download(id_giscoR = "countries", resolution = "60")
## End(Not run)
Check if R has access to resources at https://gisco-services.ec.europa.eu/distribution/v2/.
gisco_check_access()
a logical.
gisco_check_access()
Use this function with caution. This function would clear your cached data and configuration, specifically:
Deletes the giscoR config directory
(rappdirs::user_config_dir("giscoR", "R")
).
Deletes the cache_dir
directory.
Deletes the values on stored on Sys.getenv("GISCO_CACHE_DIR")
and
options(gisco_cache_dir)
.
gisco_clear_cache(config = FALSE, cached_data = TRUE, verbose = FALSE)
config |
if |
cached_data |
If this is set to |
verbose |
Logical, displays information. Useful for debugging,
default is |
This is an overkill function that is intended to reset your status as it you would never have installed and/or used giscoR.
Invisible. This function is called for its side effects.
Other cache utilities:
gisco_detect_cache_dir()
,
gisco_set_cache_dir()
# Don't run this! It would modify your current state
## Not run:
gisco_clear_cache(verbose = TRUE)
Sys.getenv("GISCO_CACHE_DIR")
# Set new cache on a temp dir
newcache <- file.path(tempdir(), "giscoR", "pkgdown")
newcache
gisco_set_cache_dir(newcache)
Sys.getenv("GISCO_CACHE_DIR")
## End(Not run)
POLYGON
objectA sf
object as provided by GISCO (2016 version).
A POLYGON
data frame (resolution: 1:20million, EPSG:4326) object with
3 variables:
Coast ID
FID
geometry field
COAS_RG_20M_2016_4326.geojson file.
Other dataset:
gisco_countries
,
gisco_countrycode
,
gisco_nuts
,
tgs00026
coasts <- gisco_coastallines
library(ggplot2)
ggplot(coasts) +
geom_sf(color = "blue", fill = "blue", alpha = 0.2) +
# Zoom on Oceania
coord_sf(
xlim = c(96, 179),
ylim = c(-51, 11)
) +
theme_minimal() +
theme(
plot.background = element_rect(
fill = "black",
color = "black"
),
panel.grid = element_blank(),
axis.text = element_text(colour = "grey90")
)
POLYGON
objectA sf
object including all
countries as provided by GISCO (2016 version).
A MULTIPOLYGON
data frame (resolution: 1:20million, EPSG:4326) object
with 257 rows and 7 variables:
row ID
Official country name on local language
ISO 3166-1 alpha-3 code of each country, as provided by GISCO
Country ID
Country name in English
FID
geometry field
CNTR_RG_20M_2016_4326.geojson file.
Other dataset:
gisco_coastallines
,
gisco_countrycode
,
gisco_nuts
,
tgs00026
cntry <- gisco_countries
GBR <- subset(cntry, ISO3_CODE == "GBR")
library(ggplot2)
ggplot(GBR) +
geom_sf(color = "red3", fill = "blue4") +
theme_void()
A dataframe containing conversions between different country code schemes (Eurostat/ISO2 and 3) as well as geographic regions as provided by the World Bank and the UN (M49). This dataset is extracted from countrycode package.
A data frame object with 249 rows and 13 variables:
Eurostat code of each country.
ISO 3166-1 alpha-2 code of each country.
ISO 3166-1 alpha-3 code of each country.
ISO English short name.
English short name as provided by the Unicode Common Locale Data Repository.
As provided by the World Bank.
Numeric region code UN (M49).
Region name UN (M49).
Numeric intermediate Region.
Intermediate Region name UN (M49).
Numeric sub-region code UN (M49).
Sub-Region name UN (M49).
Logical indicating if the country belongs to the European.
countrycode::codelist v1.2.0.
gisco_get_countries()
,
countrycode::codelist, countrycode::countrycode-package
See also the Unicode Common Locale Data Repository.
Other dataset:
gisco_coastallines
,
gisco_countries
,
gisco_nuts
,
tgs00026
data(gisco_countrycode)
cache_dir
Detect the path to your current cache_dir
. See gisco_set_cache_dir()
gisco_detect_cache_dir(...)
... |
Ignored |
The path to the cache_dir
used in this session
Other cache utilities:
gisco_clear_cache()
,
gisco_set_cache_dir()
gisco_detect_cache_dir()
Loads a sf
object from GISCO API or your local library.
gisco_get_airports(
year = "2013",
country = NULL,
cache_dir = NULL,
update_cache = FALSE,
verbose = FALSE
)
gisco_get_ports(
year = "2013",
country = NULL,
cache_dir = NULL,
update_cache = FALSE,
verbose = FALSE
)
year |
Year of reference. Only year available right now is "2013". |
country |
Optional. A character vector of country codes. It could be
either a vector of country names, a vector of ISO3 country codes or a
vector of Eurostat country codes. Mixed types (as |
cache_dir |
A path to a cache directory. See About caching. |
update_cache |
A logical whether to update cache. Default is |
verbose |
Logical, displays information. Useful for debugging,
default is |
gisco_get_airports()
refer to Europe. All shapefiles provided in
EPSG:4326.
gisco_get_ports()
adds a new field CNTR_ISO2
to the original data
identifying the country of the port. Worldwide information available.
The port codes are aligned with
UN/LOCODE standard.
A POINT
object on EPSG:4326.
You can set your cache_dir
with gisco_set_cache_dir()
.
Sometimes cached files may be corrupt. On that case, try re-downloading
the data setting update_cache = TRUE
.
If you experience any problem on download, try to download the
corresponding .geojson file by any other method and save it on your
cache_dir
. Use the option verbose = TRUE
for debugging the API query.
For a complete list of files available check gisco_db.
https://ec.europa.eu/eurostat/web/gisco/geodata/reference-data/transport-networks
Other infrastructure:
gisco_get_healthcare()
library(sf)
Greece <- gisco_get_countries(country = "EL", resolution = "1")
AirP_GC <- gisco_get_airports(country = "EL")
AirP_GC <- st_transform(AirP_GC, st_crs(Greece))
library(ggplot2)
ggplot(Greece) +
geom_sf(fill = "grey80") +
geom_sf(data = AirP_GC, color = "blue") +
labs(
title = "Airports on Greece",
shape = NULL,
color = NULL,
caption = gisco_attributions()
)
##############################
# Plot ports #
##############################
ports <- gisco_get_ports()
coast <- gisco_get_coastallines(year = 2013)
# To Equal Earth projection :)
library(sf)
coast <- st_transform(coast, 8857)
ports <- st_transform(ports, st_crs(coast))
ggplot(coast) +
geom_sf(fill = "#F6E1B9", color = "#0978AB") +
geom_sf(data = ports, fill = "red", shape = 21) +
theme_void() +
theme(
panel.background = element_rect(fill = "#C6ECFF"),
panel.grid = element_blank(),
plot.title = element_text(face = "bold", hjust = 0.5),
plot.subtitle = element_text(face = "italic", hjust = 0.5)
) +
labs(
title = "Ports Worldwide", subtitle = "Year 2013",
caption = "(c) European Union, 1995 - today"
)
sf
polygonsDownloads worldwide coastlines
gisco_get_coastallines(
year = "2016",
epsg = "4326",
cache = TRUE,
update_cache = FALSE,
cache_dir = NULL,
verbose = FALSE,
resolution = "20"
)
year |
Release year. One of "2006", "2010", "2013" or "2016" |
epsg |
projection of the map: 4-digit EPSG code. One of:
|
cache |
A logical whether to do caching. Default is |
update_cache |
A logical whether to update cache. Default is |
cache_dir |
A path to a cache directory. See About caching. |
verbose |
Logical, displays information. Useful for debugging,
default is |
resolution |
Resolution of the geospatial data. One of
|
A sf
POLYGON
object.
You can set your cache_dir
with gisco_set_cache_dir()
.
Sometimes cached files may be corrupt. On that case, try re-downloading
the data setting update_cache = TRUE
.
If you experience any problem on download, try to download the
corresponding .geojson file by any other method and save it on your
cache_dir
. Use the option verbose = TRUE
for debugging the API query.
For a complete list of files available check gisco_db.
Please check the download and usage provisions on gisco_attributions()
.
https://gisco-services.ec.europa.eu/distribution/v2/
Other political:
gisco_bulk_download()
,
gisco_get_countries()
,
gisco_get_lau()
,
gisco_get_nuts()
,
gisco_get_postalcodes()
,
gisco_get_units()
,
gisco_get_urban_audit()
coast <- gisco_get_coastallines()
library(ggplot2)
ggplot(coast) +
geom_sf(color = "#1278AB", fill = "#FDFBEA") +
# Zoom on Caribe
coord_sf(
xlim = c(-99, -49),
ylim = c(4, 30)
) +
theme_minimal() +
theme(panel.background = element_rect(fill = "#C7E7FB", color = "black"))
sf
polygons, points and linesReturns world country polygons, lines and points at a specified scale, as provided by GISCO. Also, specific areas as Gibraltar or Antarctica are presented separately. The definition of country used on GISCO correspond roughly with territories with an official ISO-3166 code.
gisco_get_countries(
year = "2016",
epsg = "4326",
cache = TRUE,
update_cache = FALSE,
cache_dir = NULL,
verbose = FALSE,
resolution = "20",
spatialtype = "RG",
country = NULL,
region = NULL
)
year |
Release year of the file. One of "2001", "2006", "2010", "2013", "2016" or "2020". |
epsg |
projection of the map: 4-digit EPSG code. One of:
|
cache |
A logical whether to do caching. Default is |
update_cache |
A logical whether to update cache. Default is |
cache_dir |
A path to a cache directory. See About caching. |
verbose |
Logical, displays information. Useful for debugging,
default is |
resolution |
Resolution of the geospatial data. One of
|
spatialtype |
Type of geometry to be returned:
|
country |
Optional. A character vector of country codes. It could be
either a vector of country names, a vector of ISO3 country codes or a
vector of Eurostat country codes. Mixed types (as |
region |
Optional. A character vector of UN M49 region codes or European Union membership. Possible values are "Africa", "Americas", "Asia", "Europe", "Oceania" or "EU" for countries belonging to the European Union (as per 2021). See About world regions and gisco_countrycode |
A sf
object specified by spatialtype
.
You can set your cache_dir
with gisco_set_cache_dir()
.
Sometimes cached files may be corrupt. On that case, try re-downloading
the data setting update_cache = TRUE
.
If you experience any problem on download, try to download the
corresponding .geojson file by any other method and save it on your
cache_dir
. Use the option verbose = TRUE
for debugging the API query.
For a complete list of files available check gisco_db.
Regions are defined as per the geographic regions defined by the
UN (see https://unstats.un.org/unsd/methodology/m49/.
Under this scheme Cyprus is assigned to Asia. You may use
region = "EU"
to get the EU members (reference date: 2021).
Please check the download and usage provisions on gisco_attributions()
.
https://gisco-services.ec.europa.eu/distribution/v2/
gisco_countrycode()
, gisco_countries,
countrycode::countrycode()
Other political:
gisco_bulk_download()
,
gisco_get_coastallines()
,
gisco_get_lau()
,
gisco_get_nuts()
,
gisco_get_postalcodes()
,
gisco_get_units()
,
gisco_get_urban_audit()
cntries <- gisco_get_countries()
library(ggplot2)
ggplot(cntries) +
geom_sf()
# Get a region
africa <- gisco_get_countries(region = "Africa")
ggplot(africa) +
geom_sf(fill = "#078930", col = "white") +
theme_minimal()
These datasets contain grid cells covering the European land territory, for various resolutions from 1km to 100km. Base statistics such as population figures are provided for these cells.
gisco_get_grid(
resolution = "20",
spatialtype = c("REGION", "POINT"),
cache_dir = NULL,
update_cache = FALSE,
verbose = FALSE
)
resolution |
Resolution of the grid cells on kms. Available values are "1", "2", "5", "10", "20", "50", "100". See Details |
spatialtype |
Select one of "REGION" or "POINT". |
cache_dir |
A path to a cache directory. See About caching. |
update_cache |
A logical whether to update cache. Default is |
verbose |
Logical, displays information. Useful for debugging,
default is |
Files are distributed on EPSG:3035.
The file sizes range is from 428Kb (resolution = "100"
)
to 1.7Gb resolution = "1"
. For resolutions 1km and 2km you would
need to confirm the download.
A POLYGON/POINT
object.
You can set your cache_dir
with gisco_set_cache_dir()
.
Sometimes cached files may be corrupt. On that case, try re-downloading
the data setting update_cache = TRUE
.
If you experience any problem on download, try to download the
corresponding .geojson file by any other method and save it on your
cache_dir
. Use the option verbose = TRUE
for debugging the API query.
For a complete list of files available check gisco_db.
There are specific downloading provisions, please see https://ec.europa.eu/eurostat/web/gisco/geodata/reference-data/grids
dieghernan, https://github.com/dieghernan/
https://ec.europa.eu/eurostat/web/gisco/geodata/reference-data/grids
grid <- gisco_get_grid(resolution = 20)
# If downloaded correctly proceed
if (!is.null(grid)) {
grid$popdens <- grid$TOT_P_2011 / 20
breaks <- c(
0, 0.1, 100, 500, 1000, 2500, 5000, 10000,
25000, max(grid$popdens) + 1
)
# Cut groups
grid$popdens_cut <- cut(grid$popdens,
breaks = breaks,
include.lowest = TRUE
)
cut_labs <- prettyNum(breaks, big.mark = " ")[-1]
cut_labs[1] <- "0"
cut_labs[9] <- "> 25 000"
pal <- c("black", hcl.colors(length(breaks) - 2,
palette = "Spectral",
alpha = 0.9
))
library(ggplot2)
ggplot(grid) +
geom_sf(aes(fill = popdens_cut), color = NA, linewidth = 0) +
coord_sf(
xlim = c(2500000, 7000000),
ylim = c(1500000, 5200000)
) +
scale_fill_manual(
values = pal, na.value = "black",
name = "people per sq. kilometer",
labels = cut_labs,
guide = guide_legend(
direction = "horizontal",
keyheight = 0.5,
keywidth = 2,
title.position = "top",
title.hjust = 0.5,
label.hjust = .5,
nrow = 1,
byrow = TRUE,
reverse = FALSE,
label.position = "bottom"
)
) +
theme_void() +
labs(
title = "Population density in Europe",
subtitle = "Grid: 20 km.",
caption = gisco_attributions()
) +
theme(
plot.background = element_rect(fill = "grey2"),
plot.title = element_text(
size = 18, color = "white",
hjust = 0.5,
),
plot.subtitle = element_text(
size = 14,
color = "white",
hjust = 0.5,
face = "bold"
),
plot.caption = element_text(
size = 9, color = "grey60",
hjust = 0.5, vjust = 0,
margin = margin(t = 5, b = 10)
),
legend.text = element_text(
size = 8,
color = "white"
),
legend.title = element_text(
color = "white"
),
legend.position = "bottom"
)
}
The dataset contains information on main healthcare services considered to be 'hospitals' by Member States.
gisco_get_healthcare(
cache = TRUE,
update_cache = FALSE,
cache_dir = NULL,
verbose = FALSE,
country = NULL
)
cache |
A logical whether to do caching. Default is |
update_cache |
A logical whether to update cache. Default is |
cache_dir |
A path to a cache directory. See About caching. |
verbose |
Logical, displays information. Useful for debugging,
default is |
country |
Optional. A character vector of country codes. It could be
either a vector of country names, a vector of ISO3 country codes or a
vector of Eurostat country codes. Mixed types (as |
Files are distributed on EPSG:4326. Metadata available on https://gisco-services.ec.europa.eu/pub/healthcare/metadata.pdf.
A POINT
object.
You can set your cache_dir
with gisco_set_cache_dir()
.
Sometimes cached files may be corrupt. On that case, try re-downloading
the data setting update_cache = TRUE
.
If you experience any problem on download, try to download the
corresponding .geojson file by any other method and save it on your
cache_dir
. Use the option verbose = TRUE
for debugging the API query.
For a complete list of files available check gisco_db.
dieghernan, https://github.com/dieghernan/
https://ec.europa.eu/eurostat/web/gisco/geodata/reference-data/healthcare-services
Other infrastructure:
gisco_get_airports()
health_BEL <- gisco_get_healthcare(country = "Belgium")
# If downloaded
if (!is.null(health_BEL)) {
health_BEL[health_BEL$public_private == "", ]$public_private <- "unknown"
BEL <- gisco_get_nuts(country = "Belgium", nuts_level = 2)
library(ggplot2)
ggplot(BEL) +
geom_sf(fill = "white", color = "grey80") +
geom_sf(
data = health_BEL, aes(color = public_private),
alpha = 0.5, size = 3
) +
theme_bw() +
labs(
title = "Healthcare in Belgium",
subtitle = "NUTS 2",
fill = "type",
caption = paste0(gisco_attributions())
) +
scale_color_manual(name = "type", values = hcl.colors(3, "Berlin")) +
theme_minimal()
}
sf
polygons, points and linesgisco_get_communes()
and gisco_get_lau()
download shapes of Local
Urban Areas, that correspond roughly with towns and cities.
gisco_get_communes(
year = "2016",
epsg = "4326",
cache = TRUE,
update_cache = FALSE,
cache_dir = NULL,
verbose = FALSE,
spatialtype = "RG",
country = NULL
)
gisco_get_lau(
year = "2016",
epsg = "4326",
cache = TRUE,
update_cache = FALSE,
cache_dir = NULL,
verbose = FALSE,
country = NULL,
gisco_id = NULL
)
year |
Release year of the file. See Details. |
epsg |
projection of the map: 4-digit EPSG code. One of:
|
cache |
A logical whether to do caching. Default is |
update_cache |
A logical whether to update cache. Default is |
cache_dir |
A path to a cache directory. See About caching. |
verbose |
Logical, displays information. Useful for debugging,
default is |
spatialtype |
Type of geometry to be returned:
|
country |
Optional. A character vector of country codes. It could be
either a vector of country names, a vector of ISO3 country codes or a
vector of Eurostat country codes. Mixed types (as |
gisco_id |
Optional. A character vector of GISCO_ID LAU values. |
Valid years for eacg function are:
gisco_get_communes
: one of '2001', '2004', '2006', '2008', '2010',
'2013' or '2016'.
gisco_get_lau
: one of
'2011', '2012', '2013', '2014', '2015', '2016', '2017', '2018', '2019', '2020'.
A sf
object specified by spatialtype
. In the case of
gisco_get_lau()
, a POLYGON
object.
You can set your cache_dir
with gisco_set_cache_dir()
.
Sometimes cached files may be corrupt. On that case, try re-downloading
the data setting update_cache = TRUE
.
If you experience any problem on download, try to download the
corresponding .geojson file by any other method and save it on your
cache_dir
. Use the option verbose = TRUE
for debugging the API query.
For a complete list of files available check gisco_db.
Please check the download and usage provisions on gisco_attributions()
.
Other political:
gisco_bulk_download()
,
gisco_get_coastallines()
,
gisco_get_countries()
,
gisco_get_nuts()
,
gisco_get_postalcodes()
,
gisco_get_units()
,
gisco_get_urban_audit()
ire_lau <- gisco_get_communes(spatialtype = "LB", country = "Ireland")
if (!is.null(ire_lau)) {
library(ggplot2)
ggplot(ire_lau) +
geom_sf(shape = 21, col = "#009A44", size = 0.5) +
labs(
title = "Communes in Ireland",
subtitle = "Year 2016",
caption = gisco_attributions()
) +
theme_void() +
theme(text = element_text(
colour = "#009A44",
family = "serif", face = "bold"
))
}
sf
polygons, points and linesReturns NUTS regions polygons, lines and points at a specified scale, as provided by GISCO.
NUTS are provided at three different levels:
"0": Country level
"1": Groups of states/regions
"2": States/regions
"3": Counties/provinces/districts
Note that NUTS-level definition may vary across countries. See also https://ec.europa.eu/eurostat/web/nuts/background.
gisco_get_nuts(
year = "2016",
epsg = "4326",
cache = TRUE,
update_cache = FALSE,
cache_dir = NULL,
verbose = FALSE,
resolution = "20",
spatialtype = "RG",
country = NULL,
nuts_id = NULL,
nuts_level = "all"
)
year |
Release year of the file. One of "2003", "2006, "2010", "2013", "2016" or "2021". |
epsg |
projection of the map: 4-digit EPSG code. One of:
|
cache |
A logical whether to do caching. Default is |
update_cache |
A logical whether to update cache. Default is |
cache_dir |
A path to a cache directory. See About caching. |
verbose |
Logical, displays information. Useful for debugging,
default is |
resolution |
Resolution of the geospatial data. One of
|
spatialtype |
Type of geometry to be returned:
|
country |
Optional. A character vector of country codes. It could be
either a vector of country names, a vector of ISO3 country codes or a
vector of Eurostat country codes. Mixed types (as |
nuts_id |
Optional. A character vector of NUTS IDs. |
nuts_level |
NUTS level. One of "0", "1", "2" or "3". See Description. |
A sf
object specified by spatialtype
. The resulting sf
object
would present an additional column geo
(equal to NUTS_ID
) for
improving compatibility with eurostat package. See
eurostat::get_eurostat_geospatial()
). See also gisco_nuts to
understand the columns and values provided.
You can set your cache_dir
with gisco_set_cache_dir()
.
Sometimes cached files may be corrupt. On that case, try re-downloading
the data setting update_cache = TRUE
.
If you experience any problem on download, try to download the
corresponding .geojson file by any other method and save it on your
cache_dir
. Use the option verbose = TRUE
for debugging the API query.
For a complete list of files available check gisco_db.
https://gisco-services.ec.europa.eu/distribution/v2/
gisco_nuts, gisco_get_countries()
,
eurostat::get_eurostat_geospatial()
Other political:
gisco_bulk_download()
,
gisco_get_coastallines()
,
gisco_get_countries()
,
gisco_get_lau()
,
gisco_get_postalcodes()
,
gisco_get_units()
,
gisco_get_urban_audit()
nuts2 <- gisco_get_nuts(nuts_level = 2)
library(ggplot2)
ggplot(nuts2) +
geom_sf() +
# ETRS89 / ETRS-LAEA
coord_sf(
crs = 3035, xlim = c(2377294, 7453440),
ylim = c(1313597, 5628510)
) +
labs(title = "NUTS-2 levels")
# NUTS-3 for Germany
germany_nuts3 <- gisco_get_nuts(nuts_level = 3, country = "Germany")
ggplot(germany_nuts3) +
geom_sf() +
labs(
title = "NUTS-3 levels",
subtitle = "Germany",
caption = gisco_attributions()
)
# Select specific regions
select_nuts <- gisco_get_nuts(nuts_id = c("ES2", "FRJ", "FRL", "ITC"))
ggplot(select_nuts) +
geom_sf(aes(fill = CNTR_CODE)) +
scale_fill_viridis_d()
Get postal codes points of the EU, EFTA and candidate countries.
gisco_get_postalcodes(
year = "2020",
country = NULL,
cache_dir = NULL,
update_cache = FALSE,
verbose = FALSE
)
year |
Year of reference. Currently only "2020" is available. |
country |
Optional. A character vector of country codes. It could be
either a vector of country names, a vector of ISO3 country codes or a
vector of Eurostat country codes. Mixed types (as |
cache_dir |
A path to a cache directory. See About caching. |
update_cache |
A logical whether to update cache. Default is |
verbose |
Logical, displays information. Useful for debugging,
default is |
The postal code point dataset shows the location of postal codes, NUTS codes and the Degree of Urbanisation classification across the EU, EFTA and candidate countries from a variety of sources. Its primary purpose is to create correspondence tables for the NUTS classification (EC) 1059/2003 as part of the Tercet Regulation (EU) 2017/2391
A POINT
object on EPSG:4326.
The dataset is released under the CC-BY-SA-4.0 licence and requires the following attribution whenever used:
(c) European Union - GISCO, 2021, postal code point dataset, Licence CC-BY-SA 4.0 available at https://ec.europa.eu/eurostat/web/gisco/geodata/reference-data
Shapefiles provided in ETRS89 (EPSG:4258).
You can set your cache_dir
with gisco_set_cache_dir()
.
Sometimes cached files may be corrupt. On that case, try re-downloading
the data setting update_cache = TRUE
.
If you experience any problem on download, try to download the
corresponding .geojson file by any other method and save it on your
cache_dir
. Use the option verbose = TRUE
for debugging the API query.
For a complete list of files available check gisco_db.
https://ec.europa.eu/eurostat/web/gisco/geodata/reference-data/postal-codes
Other political:
gisco_bulk_download()
,
gisco_get_coastallines()
,
gisco_get_countries()
,
gisco_get_lau()
,
gisco_get_nuts()
,
gisco_get_units()
,
gisco_get_urban_audit()
# Heavy-weight download!
## Not run:
pc_bel <- gisco_get_postalcodes(country = "BE")
if (!is.null(pc_bel)) {
library(ggplot2)
ggplot(pc_bel) +
geom_sf(color = "gold") +
theme_bw() +
labs(
title = "Postcodes of Belgium",
subtitle = "2020",
caption = paste("(c) European Union - GISCO, 2021,",
"postal code point dataset",
"Licence CC-BY-SA 4.0",
sep = "\n"
)
)
}
## End(Not run)
Download individual shapefiles of units. Unlike gisco_get_countries()
,
gisco_get_nuts()
or gisco_get_urban_audit()
, that downloads a full
dataset and applies filters, gisco_get_units()
downloads a single
shapefile for each unit.
gisco_get_units(
id_giscoR = c("nuts", "countries", "urban_audit"),
unit = "ES4",
mode = c("sf", "df"),
year = "2016",
epsg = "4326",
cache = TRUE,
update_cache = FALSE,
cache_dir = NULL,
verbose = FALSE,
resolution = "20",
spatialtype = "RG"
)
id_giscoR |
Select the |
unit |
Unit ID to be downloaded. See Details. |
mode |
Controls the output of the function. Possible values are "sf" or "df". See Value and Details. |
year |
Release year of the file. One of "2001", "2006", "2010", "2013", "2016" or "2020". |
epsg |
projection of the map: 4-digit EPSG code. One of:
|
cache |
A logical whether to do caching. Default is |
update_cache |
A logical whether to update cache. Default is |
cache_dir |
A path to a cache directory. See About caching. |
verbose |
Logical, displays information. Useful for debugging,
default is |
resolution |
Resolution of the geospatial data. One of
|
spatialtype |
Type of geometry to be returned: "RG", for |
The function can return a dataframe on mode = "df"
or a sf
object
on mode = "sf"
.
In order to see the available unit
ids with the required
combination of spatialtype, year
, first run the function on "df"
mode. Once that you get the data frame you can select the required ids
on the unit
parameter.
On mode = "df"
the only relevant parameters are spatialtype, year
.
A sf
object on mode = "sf"
or a dataframe on mode = "df"
.
You can set your cache_dir
with gisco_set_cache_dir()
.
Sometimes cached files may be corrupt. On that case, try re-downloading
the data setting update_cache = TRUE
.
If you experience any problem on download, try to download the
corresponding .geojson file by any other method and save it on your
cache_dir
. Use the option verbose = TRUE
for debugging the API query.
For a complete list of files available check gisco_db.
Country-level files would be renamed on your cache_dir
to avoid naming conflicts with NUTS-0 datasets.
Please check the download and usage provisions on gisco_attributions()
.
dieghernan, https://github.com/dieghernan/
https://gisco-services.ec.europa.eu/distribution/v2/
Other political:
gisco_bulk_download()
,
gisco_get_coastallines()
,
gisco_get_countries()
,
gisco_get_lau()
,
gisco_get_nuts()
,
gisco_get_postalcodes()
,
gisco_get_urban_audit()
cities <- gisco_get_units(
id_giscoR = "urban_audit",
mode = "df",
year = "2020"
)
VAL <- cities[grep("Valencia", cities$URAU_NAME), ]
# Order from big to small
VAL <- VAL[order(as.double(VAL$AREA_SQM), decreasing = TRUE), ]
VAL.sf <- gisco_get_units(
id_giscoR = "urban_audit",
year = "2020",
unit = VAL$URAU_CODE
)
# Provincia
Provincia <-
gisco_get_units(
id_giscoR = "nuts",
unit = c("ES523"),
resolution = "01"
)
# Reorder
VAL.sf$URAU_CATG <- factor(VAL.sf$URAU_CATG, levels = c("F", "K", "C"))
# Plot
library(ggplot2)
ggplot(Provincia) +
geom_sf(fill = "gray1") +
geom_sf(data = VAL.sf, aes(fill = URAU_CATG)) +
scale_fill_viridis_d() +
labs(
title = "Valencia",
subtitle = "Urban Audit",
fill = "Urban Audit\ncategory"
)
sf
polygons and pointsReturns polygons and points corresponding to cities, greater cities and metropolitan areas included on the Urban Audit report of Eurostat.
gisco_get_urban_audit(
year = "2020",
epsg = "4326",
cache = TRUE,
update_cache = FALSE,
cache_dir = NULL,
verbose = FALSE,
spatialtype = "RG",
country = NULL,
level = NULL
)
year |
Release year of the file. One of "2001", "2004", "2014", "2018" or "2020". |
epsg |
projection of the map: 4-digit EPSG code. One of:
|
cache |
A logical whether to do caching. Default is |
update_cache |
A logical whether to update cache. Default is |
cache_dir |
A path to a cache directory. See About caching. |
verbose |
Logical, displays information. Useful for debugging,
default is |
spatialtype |
Type of geometry to be returned:
|
country |
Optional. A character vector of country codes. It could be
either a vector of country names, a vector of ISO3 country codes or a
vector of Eurostat country codes. Mixed types (as |
level |
Level of Urban Audit. Possible values are "CITIES", "FUA",
"GREATER_CITIES" or |
A sf
object specified by spatialtype
.
You can set your cache_dir
with gisco_set_cache_dir()
.
Sometimes cached files may be corrupt. On that case, try re-downloading
the data setting update_cache = TRUE
.
If you experience any problem on download, try to download the
corresponding .geojson file by any other method and save it on your
cache_dir
. Use the option verbose = TRUE
for debugging the API query.
For a complete list of files available check gisco_db.
Please check the download and usage provisions on gisco_attributions()
.
https://gisco-services.ec.europa.eu/distribution/v2/
gisco_get_communes()
, gisco_get_lau()
Other political:
gisco_bulk_download()
,
gisco_get_coastallines()
,
gisco_get_countries()
,
gisco_get_lau()
,
gisco_get_nuts()
,
gisco_get_postalcodes()
,
gisco_get_units()
cities <- gisco_get_urban_audit(year = "2020", level = "CITIES")
if (!is.null(cities)) {
bcn <- cities[cities$URAU_NAME == "Barcelona", ]
library(ggplot2)
ggplot(bcn) +
geom_sf()
}
POLYGON
objectA sf
object including all NUTS levels as provided by GISCO (2016 version).
A POLYGON
data frame (resolution: 1:20million, EPSG:4326) object with
2,016 rows and
11 variables:
NUTS identifier
NUTS level code (0,1,2,3)
Urban Type, see Details
Eurostat Country code
NUTS name on Latin characters
NUTS name on local alphabet
Mount Type, see Details
Coast Type, see Details
FID
Same as NUTS_ID, provided for compatibility with eurostat
geometry field
MOUNT_TYPE: Mountain typology:
1: More than 50 % of the surface is covered by topographic mountain areas.
2: More than 50 % of the regional population lives in topographic mountain areas.
3: More than 50 % of the surface is covered by topographic mountain areas and where more than 50 % of the regional population lives in these mountain areas.
4: Non-mountain region / other regions.
0: No classification provided
URBN_TYPE: Urban-rural typology:
1: Predominantly urban region.
2: Intermediate region.
3: Predominantly rural region.
0: No classification provided
COAST_TYPE: Coastal typology:
1: Coastal (on coast).
2: Coastal (less than 50% of population living within 50 km. of the coastline).
3: Non-coastal region.
0: No classification provided
NUTS_RG_20M_2016_4326.geojson file.
Other dataset:
gisco_coastallines
,
gisco_countries
,
gisco_countrycode
,
tgs00026
nuts <- gisco_nuts
italy <- subset(nuts, CNTR_CODE == "IT" & LEVL_CODE == 3)
library(ggplot2)
ggplot(italy) +
geom_sf()
This function will store your cache_dir
path on your local machine and
would load it for future sessions. Type Sys.getenv("GISCO_CACHE_DIR")
to
find your cached path.
Alternatively, you can store the cache_dir
manually with the following
options:
Run Sys.setenv(GISCO_CACHE_DIR = "cache_dir")
. You would need to
run this command on each session (Similar to install = FALSE
).
Set options(gisco_cache_dir = "cache_dir")
. Similar to the previous
option. This is not recommended any more, and it is provided for
backwards compatibility purposes.
Write this line on your .Renviron file:
GISCO_CACHE_DIR = "value_for_cache_dir"
(same behavior than
install = TRUE
). This would store your cache_dir
permanently.
gisco_set_cache_dir(
cache_dir,
overwrite = FALSE,
install = FALSE,
verbose = TRUE
)
cache_dir |
A path to a cache directory. On missing value the function
would store the cached files on a temporary dir (See |
overwrite |
If this is set to |
install |
if |
verbose |
Logical, displays information. Useful for debugging,
default is |
An (invisible) character with the path to your cache_dir
.
Other cache utilities:
gisco_clear_cache()
,
gisco_detect_cache_dir()
# Don't run this! It would modify your current state
## Not run:
gisco_set_cache_dir(verbose = TRUE)
## End(Not run)
Sys.getenv("GISCO_CACHE_DIR")
The disposable income of private households is the balance of primary income (operating surplus/mixed income plus compensation of employees plus property income received minus property income paid) and the redistribution of income in cash. These transactions comprise social contributions paid, social benefits in cash received, current taxes on income and wealth paid, as well as other current transfers. Disposable income does not include social transfers in kind coming from public administrations or non-profit institutions serving households.
data_frame:
NUTS2 identifier
reference year (2007 to 2018)
value in euros
https://ec.europa.eu/eurostat, extracted on 2020-10-27
Other dataset:
gisco_coastallines
,
gisco_countries
,
gisco_countrycode
,
gisco_nuts
data(tgs00026)