Learn R Programming

rgugik

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

FunctionInputDastaset ENDataset PL
ortho_request(), tile_download()geometryOrthophotomapOrtofotomapa
geodb_download()voivodeshipGeneral Geographic DatabaseBaza Danych Obiektów Ogólnogeograficznych
topodb_download()countyTopographic DatabaseBaza Danych Obiektów Topograficznych
emuia_download()communeRegister of Towns, Streets and AddressesEwidencja Miejscowości, Ulic i Adresów
geonames_download()typeState Register of Geographical NamesPaństwowy Rejestr Nazw Geograficznych
borders_get(), borders_download()typeState Register of BordersPaństwowy Rejestr Granic
parcel_get()parcel ID, coordinatesLocation of cadastral parcelsLokalizacja działek katastralnych
models3D_download()county3D models of buildingsModele 3D budynków
DEM_request(), tile_download()geometryDigital elevation modelsCyfrowe modele wysokościowe

There are the additional functions for obtaining digital terrain model:

  • pointDTM_get() for small areas (high resolution grid)
  • pointDTM100_download() for voivodeships areas (low resolution grid)
  • minmaxDTM_get() to find the minimum and maximum elevation (small areas)

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

  • voivodeship_names (16)
  • county_names (380)
  • commune_names (2476)

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

  • ortho_request() - returns a data frame with metadata and links to the orthoimages for a given geometry (point, line or polygon)
  • tile_download() - downloads orthoimages based on the data frame obtained using the ortho_request() function
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)
#>             23                                                                              
#> sheetID     "N-33-130-D-b-2-3"                                                              
#> year        "2001"                                                                          
#> resolution  "1"                                                                             
#> composition "RGB"                                                                           
#> sensor      "Satellite"                                                                     
#> CRS         "PL-1992"                                                                       
#> date        "2001-01-01"                                                                    
#> isFilled    "TRUE"                                                                          
#> URL         "https://opendata.geoportal.gov.pl/ortofotomapa/41/41_3756_N-33-130-D-b-2-3.tif"
#> filename    "41_3756_N-33-130-D-b-2-3"                                                      
#> seriesID    "41"

# download image
tile_download(req_df)
#> 1/1

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

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.

Copy Link

Version

Install

install.packages('rgugik')

Monthly Downloads

295

Version

0.4.1

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Last Published

May 11th, 2024

Functions in rgugik (0.4.1)

pointDTM_get

Get terrain elevation for a given polygon
rgugik-package

rgugik: Search and Retrieve Spatial Data from 'GUGiK'
geocodePL_get

Convert addresses and objects to geographic coordinates
geonames_download

Download State Register of Geographical Names
county_names

Counties in Poland
emuia_download

Download Register of Towns, Streets and Addresses for communes
DEM_request

Get metadata and links to available digital elevation models
geodb_download

Download General Geographic Databases for entire voivodeships
borders_download

Download State Register of Borders
minmaxDTM_get

Get minimum and maximum elevation for a given polygon
borders_get

Get the boundaries of administrative units
models3D_download

Download 3D models of buildings for counties
ortho_request

Get metadata and links to available orthoimages
topodb_download

Download Topographic Databases for counties
parcel_get

Get the geometry of cadastral parcels
pointDTM100_download

Download digital terrain models for voivodeships (100 m resolution)
commune_names

Communes in Poland
tile_download

Download requested tiles
voivodeship_names

Voivodeships in Poland