Learn R Programming

giscoR (version 0.2.4)

gisco_get_grid: Get the grid cells covering the European land territory

Description

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.

Usage

gisco_get_grid(
  resolution = "20",
  spatialtype = "REGION",
  cache_dir = NULL,
  update_cache = FALSE,
  verbose = FALSE
)

Arguments

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,POINT

cache_dir

A path to a cache directory. See Details on gisco_get.

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.

verbose

Display information. Useful for debugging, default is FALSE.

Value

A POLYGON/POINT object.

Details

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.

Examples

Run this code
# NOT RUN {
library(sf)

grid <- gisco_get_grid(resolution = 20)
grid$popdens <- grid$TOT_P_2011 / 20

breaks <-
  c(
    0,
    500,
    1000,
    2500,
    5000,
    10000,
    25000,
    50000,
    max(grid$popdens) + 1
  )

pal <- hcl.colors(length(breaks) - 2, palette = "inferno", alpha = 0.7)
pal <- c("black", pal)

opar <- par(no.readonly = TRUE)
par(mar = c(0, 0, 0, 0), bg = "grey2")
plot(
  grid[, "popdens"],
  pal = pal,
  key.pos = NULL,
  breaks = breaks,
  main = NA,
  xlim = c(2500000, 7000000),
  ylim = c(1500000, 5200000),
  border = NA
)
par(opar)
# }

Run the code above in your browser using DataLab