Last chance! 50% off unlimited learning
Sale ends in
Loads a simple feature (sf
) object from GISCO API entry point or your
local library.
gisco_get_coastallines(
year = "2016",
epsg = "4326",
cache = TRUE,
update_cache = FALSE,
cache_dir = NULL,
verbose = FALSE,
resolution = "20"
)gisco_get_communes(
year = "2016",
epsg = "4326",
cache = TRUE,
update_cache = FALSE,
cache_dir = NULL,
verbose = FALSE,
spatialtype = "RG",
country = NULL
)
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
)
gisco_get_lau(
year = "2016",
epsg = "4326",
cache = TRUE,
update_cache = FALSE,
cache_dir = NULL,
verbose = FALSE,
country = NULL,
gisco_id = NULL
)
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"
)
gisco_get_urban_audit(
year = "2020",
epsg = "4326",
cache = TRUE,
update_cache = FALSE,
cache_dir = NULL,
verbose = FALSE,
spatialtype = "RG",
country = NULL,
level = NULL
)
Release year. See Release years available on gisco_get
.
projection of the map: 4-digit EPSG code. One of:
"4258": ETRS89
"4326": WGS84
"3035": ETRS89 / ETRS-LAEA
"3857": Pseudo-Mercator
A logical whether to do caching. Default is TRUE
.
A logical whether to update cache. Default is FALSE
.
When set to TRUE
it would force a fresh download of the source
.geojson
file.
A path to a cache directory. See Details on gisco_get
.
Display information. Useful for debugging,
default is FALSE
.
Resolution of the geospatial data. One of
"60": 1:60million
"20": 1:20million
"10": 1:10million
"03": 1:3million
"01": 1:1million
Type of geometry to be returned:
"RG": Regions - MULTIPOLYGON/POLYGON
object.
"LB": Labels - POINT
object.
"BN": Boundaries - LINESTRING
object.
"COASTL": coastlines - LINESTRING
object.
"INLAND": inland boundaries - LINESTRING
object.
Optional. A character vector of country codes.
See Details on gisco_get
.
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
Optional. A character vector of GISCO_ID LAU values.
Optional. A character vector of NUTS IDs.
NUTS level. One of "0" (Country-level), "1", "2" or "3". See https://ec.europa.eu/eurostat/web/nuts/background.
Level of Urban Audit. Possible values are "CITIES", "FUA",
"GREATER_CITIES" or NULL
, that would download the full dataset.
A sf
object specified by spatialtype
.
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).
gisco_get_coastallines
: one of "2006", "2010", "2013" or "2016".
gisco_get_communes
: one of "2001", "2004", "2006", "2008", "2010",
"2013" or "2016".
gisco_get_countries
: one of "2001", "2006", "2010", "2013", "2016"
or "2020".
gisco_get_lau
: one of "2016", "2017", "2018" or "2019"
gisco_get_nuts
: one of "2003", "2006", "2010", "2013", "2016"
or "2021".
gisco_get_urban_audit
: one of "2001", "2004", "2014", "2018"
or "2020".
country
only available on specific datasets. Some spatialtype
options
(as "BN", "COASTL", "INLAND") may not include country-level identifiers.
country
could be either a vector of country names, a vector of ISO3
country codes or a vector of Eurostat country codes. Mixed types
(as c("Turkey","US","FRA")
) would not work.
Sometimes cached files may be corrupt. On that case, try re-downloading
the data setting update_cache = TRUE
.
Set cache_dir = "path/to/dir"
or options(gisco_cache_dir = "path/to/dir)
.
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
.
For a complete list of files available check gisco_db
.
gisco_db
, gisco_attributions()
, gisco_coastallines
# NOT RUN {
library(sf)
##################################
# Example - gisco_get_coastallines
##################################
coastlines <- gisco_get_coastallines()
plot(st_geometry(coastlines), col = "palegreen", border = "lightblue3")
title(
main = "Coastal Lines",
sub = gisco_attributions(),
line = 1
)
###############################
# Example - gisco_get_countries
###############################
sf_world <- gisco_get_countries()
plot(st_geometry(sf_world), col = "seagreen2")
title(sub = gisco_attributions(), line = 1)
sf_africa <- gisco_get_countries(region = "Africa")
plot(st_geometry(sf_africa),
col = c("springgreen4", "darkgoldenrod1", "red2")
)
title(sub = gisco_attributions(), line = 1)
sf_benelux <-
gisco_get_countries(country = c("Belgium", "Netherlands", "Luxembourg"))
plot(st_geometry(sf_benelux),
col = c("grey10", "orange", "deepskyblue2")
)
title(sub = gisco_attributions(), line = 1)
##########################
# Example - gisco_get_nuts
##########################
nuts1 <- gisco_get_nuts(
resolution = "20",
year = "2016",
epsg = "4326",
nuts_level = "1",
country = "ITA"
)
nuts2 <- gisco_get_nuts(
resolution = "20",
year = "2016",
epsg = "4326",
nuts_level = "2",
country = "ITA"
)
nuts3 <- gisco_get_nuts(
resolution = "20",
year = "2016",
epsg = "4326",
nuts_level = "3",
country = "ITA"
)
plot(st_geometry(nuts3),
border = "grey60",
lty = 3
)
plot(st_geometry(nuts2),
lwd = 2,
border = "red2",
add = TRUE
)
plot(st_geometry(nuts1),
lwd = 3,
border = "springgreen4",
add = TRUE
)
box()
title(
main = "NUTS Levels on Italy",
sub = gisco_attributions(),
cex.sub = 0.7,
line = 1
)
legend(
"topright",
legend = c("NUTS 1", "NUTS 2", "NUTS 3"),
col = c("springgreen4", "red2", "grey60"),
lty = c(1, 1, 3),
lwd = c(3, 2, 1),
bty = "n",
y.intersp = 2
)
# }
Run the code above in your browser using DataLab