rgugik – Automation of downloading GUGIK Polish geospatial data
rgugik is an R package that allows direct downloading of geospatial data from GUGiK services. With it, you can programmatically obtain, among others:
- Digital Terrain Model (DTM) and Digital Surface Model (DSM),
- Airborne Laser Scanning (ALS) data,
- orthophotos,
- administrative boundaries,
- cadastral parcel data.
The package eliminates the need to manually download data from GUGiK portals and services – just a few lines of code are enough.
The package is available on CRAN, so installation is simple:
install.packages("rgugik")
After installation, load the library:
library(rgugik)
Let’s generate an area of interest for which we want to download data:
library(sf)
roi <- st_point(c(21.0, 52.2))
roi <- st_sfc(roi, crs = 4326)
roi <- st_transform(roi, crs = 2180)
roi <- st_buffer(roi, dist = 400)
Downloading orthophotos
We can easily obtain a list of orthophotos available for the selected area:
ortho <- orto_request(roi)
And then download the first orthophoto to disk:
tile_download(ortho[1,], outdir = "D:/")
Numerical elevation data
Downloading a list of elevation data looks similar:
h_data <- DEM_request(roi)
In the downloaded table, we have both raster data (DTM and DSM) and point clouds. The distinction between different data types can be made using the product column:
h_data$product
h_data[h_data$product == 'PointCloud',]
h_data[h_data$product == 'DTM',]
Downloading data to disk is also done with the tile_download function.
Raster files can then be analyzed with the terra package, and LAS/LAZ files with the lidR package.
Downloading administrative boundaries
Do you want to download the boundary of a selected voivodeship? Nothing easier:
woj <- borders_get(voivodeship = "mazowieckie")
plot(woj)
rgugik is a tool that provides quick and automated access to GUGiK’s rich geospatial data resources. Thanks to its integration with R, it enables direct downloading and processing of data in one environment, which significantly improves analytical work.
