Learn R Programming

giscoR (version 0.3.1)

gisco_get_lau: Get GISCO urban areas sf polygons, points and lines

Description

gisco_get_communes() and gisco_get_lau() download shapes of Local Urban Areas, that correspond roughly with towns and cities.

Usage

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 )

Arguments

year

Release year of the file. See Details.

epsg

projection of the map: 4-digit EPSG code. One of:

  • "4258": ETRS89

  • "4326": WGS84

  • "3035": ETRS89 / ETRS-LAEA

  • "3857": Pseudo-Mercator

cache

A logical whether to do caching. Default is TRUE. See About caching.

update_cache

A logical whether to update cache. Default is FALSE. When set to TRUE it would force a fresh download of the source .geojson file.

cache_dir

A path to a cache directory. See About caching.

verbose

Logical, displays information. Useful for debugging, default is FALSE.

spatialtype

Type of geometry to be returned:

  • "BN": Boundaries - LINESTRING object.

  • "COASTL": coastlines - LINESTRING object.

  • "INLAND": inland boundaries - LINESTRING object.

  • "LB": Labels - POINT object.

  • "RG": Regions - MULTIPOLYGON/POLYGON object.

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 c("Turkey","US","FRA")) would not work. See also countrycode::countrycode().

gisco_id

Optional. A character vector of GISCO_ID LAU values.

Value

A sf object specified by spatialtype. In the case of gisco_get_lau(), a POLYGON object.

About caching

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.

Details

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'.

See Also

Other political: gisco_bulk_download(), gisco_get_coastallines(), gisco_get_countries(), gisco_get_nuts(), gisco_get_postalcodes(), gisco_get_units(), gisco_get_urban_audit()

Examples

Run this code
# NOT RUN {
ire_lau <- gisco_get_communes(spatialtype = "LB", country = "Ireland")

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"
  ))
# }

Run the code above in your browser using DataLab