Title: | R Package for Getting Spatial Data from FIS-Broker |
---|---|
Description: | R Package for getting spatial data from FIS-Broker (https://www.stadtentwicklung.berlin.de/geoinformation/fis-broker/). |
Authors: | Michael Rustler [aut, cre] , Hauke Sonnenberg [aut] , IMPETUS [fnd], Kompetenzzentrum Wasser Berlin gGmbH (KWB) [cph] |
Maintainer: | Michael Rustler <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.0.0.9000 |
Built: | 2024-11-16 04:36:13 UTC |
Source: | https://github.com/KWB-R/kwb.fisbroker |
Compose FIS-Broker URL
compose_fis_broker_url( cmd = "user_login", session_id = NULL, type = NULL, id = NULL )
compose_fis_broker_url( cmd = "user_login", session_id = NULL, type = NULL, id = NULL )
cmd |
command (default: "user login") |
session_id |
as retrieved by |
type |
dataset type, i.e. "ATOM", "WFS" or "WMS" (default: NULL) |
id |
dataset id (default: NULL) |
composed FIS-Broker URL
Create Full URLs to Info Pages about Datasets in Overview Table
create_info_page_hrefs(overview, dbg = TRUE)
create_info_page_hrefs(overview, dbg = TRUE)
overview |
overview tibble as retrieved by |
dbg |
whether or not to show debug messages (default: TRUE) |
vector with hrefs
Get Dataset Overview
get_dataset_overview(dbg = TRUE)
get_dataset_overview(dbg = TRUE)
dbg |
whether or not to show debug messages |
tibble with 7 columns and rows equal to number of datasets (one for each dataset type, e.g WMS, WFS, ATOM)
Category id of dataset (artifically generated)
Category name of dataset)
Dataset id, artifically generated!!!
Dataset name as listed on table
Link of dataset name. JS session Id was replaced with a placeholder
Dataset type as listed on table one of ATOM
, WFS
or
WMS
Link of dataset type. JS session Id was replaced with a placeholder
fb_dataset_overview <- kwb.fisbroker::get_dataset_overview() # View(fb_dataset_overview)
fb_dataset_overview <- kwb.fisbroker::get_dataset_overview() # View(fb_dataset_overview)
Get Urls
get_urls(..., key. = NULL)
get_urls(..., key. = NULL)
... |
further arguments passed to |
key. |
optional. Name of element to be returned from the URL dictionary.
If |
return base
and wfs
urls of FIS-Broker
# List of all defined (partial) URls get_urls() # One specific URL with placeholders replaced as given get_urls( key. = "href_type", sid = "my-session-id", type = "WFS", id = "my-id" )
# List of all defined (partial) URls get_urls() # One specific URL with placeholders replaced as given get_urls( key. = "href_type", sid = "my-session-id", type = "WFS", id = "my-id" )
The function stops with error if the GET request returns status != 200
httr_get_or_fail(url, handle = NULL)
httr_get_or_fail(url, handle = NULL)
url |
URL to which to send a GET request |
handle |
passed to |
If the status was not 200, the function returns what
GET
returned
Login to FIS-Broker
login_to_fis_broker(dbg = TRUE)
login_to_fis_broker(dbg = TRUE)
dbg |
print debug messages (default: TRUE) |
session id
login_to_fis_broker()
login_to_fis_broker()
Lookup Dataset ID Required for Download
lookup_dataset_id(overview, dataset_id, type)
lookup_dataset_id(overview, dataset_id, type)
overview |
overview tibble as retrieved by |
dataset_id |
one dataset_id from column "dataset_id" of provided overview |
type |
dataset type, i.e. "ATOM", "WFS" or "WMS" |
dataset id required for read_wfs
Read Metadata based on Overview on FIS Broker Datasets
read_all_metadata( overview = get_dataset_overview(), preserve_handle = TRUE, dbg = TRUE )
read_all_metadata( overview = get_dataset_overview(), preserve_handle = TRUE, dbg = TRUE )
overview |
overview tibble as retrieved by |
preserve_handle |
logical. If TRUE (the default is FALSE), the Curl
handle is created in advance and reused for all |
dbg |
whether or not to show debug messages (default: TRUE) |
tibble with all metdata information
## Not run: overview <- kwb.fisbroker::get_dataset_overview() overview_atom <- overview[overview$type == "ATOM",] metadata_atom <- kwb.fisbroker::read_all_metadata(overview_atom) overview_wfs <- overview[overview$type == "WFS",] metadata_wfs <- kwb.fisbroker::read_all_metadata(overview_wfs) overview_wms <- overview[overview$type == "WMS",] metadata_wms <- kwb.fisbroker::read_all_metadata(overview_wms) ## End(Not run)
## Not run: overview <- kwb.fisbroker::get_dataset_overview() overview_atom <- overview[overview$type == "ATOM",] metadata_atom <- kwb.fisbroker::read_all_metadata(overview_atom) overview_wfs <- overview[overview$type == "WFS",] metadata_wfs <- kwb.fisbroker::read_all_metadata(overview_wfs) overview_wms <- overview[overview$type == "WMS",] metadata_wms <- kwb.fisbroker::read_all_metadata(overview_wms) ## End(Not run)
Read metadata
read_metadata( dataset_id = "s_wfs_alkis_bezirk", service_type = "WFS", encoding = "Windows-1252", dbg = TRUE, url = NULL, handle = NULL )
read_metadata( dataset_id = "s_wfs_alkis_bezirk", service_type = "WFS", encoding = "Windows-1252", dbg = TRUE, url = NULL, handle = NULL )
dataset_id |
id of wfs dataset (default: "s_wfs_alkis_bezirk"). Needs to checked out manually as described below:
|
service_type |
either "WFS" or "WMS" (default: "WFS") |
encoding |
encoding of metadata FIS-Broker site (default: "Windows-1252") |
dbg |
print debug messages (default: TRUE) |
url |
optional. URL to web resource from which to load metadata. by default generated by the function |
handle |
passed to |
tibble with metadata for provided dataset_id
https://fbinter.stadt-berlin.de/fb/berlin/service_intern.jsp?id=s_wfs_alkis_bezirk@senstadt&type=WFS
### One Dataset berlin_bezirke_metadata <- read_metadata(dataset_id = "s_wfs_alkis_bezirk") berlin_bezirke_metadata ### Multiple ids_wfs <- readLines(system.file("extdata/ids_wfs.txt", package = "kwb.fisbroker")) wfs_meta_list <- setNames(lapply(ids_wfs, function(id) { kwb.fisbroker::read_metadata(id)}), ids_wfs) wfs_meta <- dplyr::bind_rows(wfs_meta_list, .id = "id_wfs") wfs_meta
### One Dataset berlin_bezirke_metadata <- read_metadata(dataset_id = "s_wfs_alkis_bezirk") berlin_bezirke_metadata ### Multiple ids_wfs <- readLines(system.file("extdata/ids_wfs.txt", package = "kwb.fisbroker")) wfs_meta_list <- setNames(lapply(ids_wfs, function(id) { kwb.fisbroker::read_metadata(id)}), ids_wfs) wfs_meta <- dplyr::bind_rows(wfs_meta_list, .id = "id_wfs") wfs_meta
Read WFS Dataset from FIS-Broker
read_wfs( dataset_id = "s_wfs_alkis_bezirk", service_version = "2.0.0", srs = "EPSG:25833", encoding = "UTF-8", dbg = TRUE )
read_wfs( dataset_id = "s_wfs_alkis_bezirk", service_version = "2.0.0", srs = "EPSG:25833", encoding = "UTF-8", dbg = TRUE )
dataset_id |
id of wfs dataset (default: "s_wfs_alkis_bezirk"). Needs to checked out manually as described below:
|
service_version |
one of "1.0.0", "1.1.0" or "2.0.0" (default: "2.0.0") |
srs |
one of "EPSG:4258" or "EPSG:25833" (default: "EPSG:25833") |
encoding |
default: UTF-8 |
dbg |
prints debug messages if TRUE (default: TRUE) |
imports selected WFS dataset into R
https://fbinter.stadt-berlin.de/fb/berlin/service_intern.jsp?id=s_wfs_alkis_bezirk@senstadt&type=WFS
berlin_bezirke <- kwb.fisbroker::read_wfs(dataset_id = "s_wfs_alkis_bezirk")
berlin_bezirke <- kwb.fisbroker::read_wfs(dataset_id = "s_wfs_alkis_bezirk")
Write to JSON or CSV
write_to(format, df)
write_to(format, df)
format |
either 'json' or 'csv' |
df |
data frame |
writes provided df to working directory with same name