knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

rgugik

CRAN R build status codecov License: MIT DOI

rgugik is an R package for downloading open data from resources of Polish Head Office of Geodesy and Cartography including:

It is also possible to geocode addresses or objects using the geocodePL_get() function.

Corresponding functions

ds_pl = c("Ortofotomapa",
          "Baza Danych Obiektów Ogólnogeograficznych",
          "Baza Danych Obiektów Topograficznych",
          "Ewidencja Miejscowości, Ulic i Adresów",
          "Ewidencja Gruntów i Budynków",
          "Państwowy Rejestr Nazw Geograficznych",
          "Państwowy Rejestr Granic",
          "Lokalizacja działek katastralnych",
          "Modele 3D budynków",
          "Cyfrowe modele wysokościowe")

ds_en = c("Orthophotomap",
          "General Geographic Database",
          "Topographic Database",
          "Register of Towns, Streets and Addresses",
          "Land and Building Register",
          "State Register of Geographical Names",
          "State Register of Borders",
          "Location of cadastral parcels",
          "3D models of buildings",
          "Digital elevation models")

fun = c("`ortho_request()`, `tile_download()`",
        "`geodb_download()`",
        "`topodb_download()`",
        "`emuia_download()`",
        "`egib_download()`",
        "`geonames_download()`",
        "`borders_get()`, `borders_download()`",
        "`parcel_get()`",
        "`models3D_download()`",
        "`DEM_request()`, `tile_download()`")

input = c("geometry",
          "voivodeship",
          "county",
          "commune",
          "county",
          "type",
          "type",
          "parcel ID, coordinates",
          "county",
          "geometry")

df = data.frame(fun, input, ds_en, ds_pl)
colnames(df) = c("Function", "Input", "Dastaset EN", "Dataset PL")

knitr::kable(df)

There are the additional functions for obtaining digital terrain model:

The names of administrative units and their IDs are included in these objects:

Installation

You can install the released version from CRAN with:

install.packages("rgugik")

You can install the development version from GitHub with:

# install.packages("remotes")
remotes::install_github("kadyb/rgugik")

Usage

Orthophotomap

library(rgugik)
library(sf)
library(stars)

polygon_path = system.file("datasets/search_area.gpkg", package = "rgugik")
polygon = read_sf(polygon_path)

req_df = ortho_request(polygon)

# select the oldest image
req_df = req_df[req_df$year == 2001, ]

# print metadata
t(req_df)

# download image
tile_download(req_df)

img = read_stars("41_3756_N-33-130-D-b-2-3.tif")
plot(st_rgb(img), main = NULL)
invisible(file.remove("41_3756_N-33-130-D-b-2-3.tif"))

Administrative boundaries

library(rgugik)
library(sf)

# get counties from opolskie voivodeship (TERYT 16)
counties = county_names
counties = counties[substr(counties$TERYT, 1, 2) == "16", "TERYT"]
counties_geom = borders_get(TERYT = counties)
plot(st_geometry(counties_geom), main = "Opolskie")

Vignettes

More advanced examples of the practical (step by step) use of this package can be found in the vignettes:

Acknowledgment

Head Office of Geodesy and Cartography in Poland is the main source of the provided data. The data is made available in accordance with the Act of May 17, 1989 Geodetic and Cartographic Law (amended on 16 April 2020).

All datasets can be explored interactively using the Geoportal.

Contribution

Contributions to this package are welcome. The preferred method of contribution is through a GitHub pull request. Feel also free to contact us by creating an issue. More detailed information can be found in the CONTRIBUTING document.

Maintainers and contributors must follow this repository’s CODE OF CONDUCT.

Citation

To cite rgugik in publications, please use the following article:

Dyba, K. and Nowosad, J. (2021). rgugik: Search and Retrieve Spatial Data from the Polish Head Office of Geodesy and Cartography in R. Journal of Open Source Software, 6(59), 2948, https://doi.org/10.21105/joss.02948

BibTeX version can be obtained with citation("rgugik").

Related projects

If you don't feel familiar with R, there is a similar QGIS tool in the EnviroSolutions repository.



kadyb/rgugik documentation built on July 4, 2025, 8:22 p.m.