Note: this is the documentation for the latest released version (the github release). Documentation for the current development version (reflecting the state of the master branch) is at https://petrbouchal.github.io/pragr/dev.
pragr
aims to provide tools for visualising data about Prague. Currently, it makes Prague raster geodata accessible for use in R via ggplot2
.
It also provides a set of utilities and shortcuts to simplify handling data about Prague.
You can install the current version of pragr
from GitHub with:
remotes::install_github("petrbouchal/pragr")
Currently, the 📦 enables you to do two things:
ggplot2
object (prg_tile()
)ggplot2
object (prg_basemap()
)The basic logic of the two core functions is that given a simple feature dataset, they provide the tiles or image to create the base map for those coordinates.
It relies on the REST API of ArcGis map/image services that power the geoportal, using documentation for the following operations (endpoints):
Additionally, the package provides
geofacet::facet_geo()
function.The approach draws heavily on code provided by @yutannihilation in his blog post on using OpenStreetMap tiles in 📦 ggplot2
.
The approach should be generalisable to other ArcGIS-driven servers with the same REST API, though the package as it now is assumes a projected CRS measured in meters, specifically the Krovak CRS (EPSG 5514).
library(pragr)
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
library(sf)
#> Linking to GEOS 3.8.1, GDAL 3.1.1, PROJ 6.3.1
library(ggplot2)
praha1 <- CzechData::load_RUIAN_settlement(prg_kod, "MOMC_P", WGS84 = F) %>%
filter(nazev == 'Praha 1')
#> ✓ Data downloaded and unpacked.
Note that the possible values of the tile_service
and image_service
parameters can be found in prg_endpoints
.
ggplot() +
prg_tile(data = praha1, zoom = 10, alpha = 1, buffer = 200,
tile_service = 'orto') +
geom_sf(data = praha1, colour = alpha("red", 0.6), fill = NA, shape = "dotted") +
theme_void()
The layer
parameter can take values that you can find by inspecting the given image service (see note on sources below).
ggplot() +
prg_basemap(data = praha1, alpha = 1, buffer = 200, width = 1000,
image_service = 'cisarske_otisky_1840_velke', layer = 1) +
geom_sf(data = praha1, colour = alpha("red", 0.6), fill = NA, shape = "dotted") +
theme_void()
The name of the package refers to Karel Prager, a renowned Czech modernist architect. Among other things, he designed - and for a long time worked in - the office buildings in which the Institute for Planning and Development, Prague’s public urban planning body, is housed today.
The institute’s excellent data team develops and maintains the data and software infrastructure for Prague’s geographical data on which this package - and much of Prague’s planning, government and business - relies.
Prag is of course how the city was once called by its many German-speaking inhabitants.
Most map/image services are accessible via http://www.geoportalpraha.cz/cs/clanek/22/mapove-sluzby
A more technical route to lists of services is via
/uap/
collection The /urk/
collection contains some interesting data (incl. construction limits (stavební uzávěry) or the spread of the build-up area over time (vývoj Prahy)).Many of these services can be used in WMS mode, i.e. as tiles for leaflet
maps, or as feature layers for webmaps - see the web article for an example.
There has recently been a migration from the “mpp." servers to the "gs − pub” servers; see http://app.iprpraha.cz/apl/app/service_viewer/ for the translation. Some services still run on http://mpp.iprpraha.cz/arcgis/rest/services but presumably these will go away at some point. For now, this is the only place where the full current Spatial plan lives (http://mpp.iprpraha.cz/arcgis/rest/services/PUP).
For some of the services, shortcut notation is implemented for use in the tile/basemap functions. See prg_endpoints
. Not all endpoint metadata in prg_endoints
has been updated to reflect the new URLs.
There will be a vignette or vignette("data-sources", package = "pragr")
.
Please note that the pragr project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.