Skip to contents

Statistics

By Type

library(kwb.fisbroker)

overview <- kwb.fisbroker::get_dataset_overview() %>% 
  dplyr::filter(.data$cmd == "navigationShowService") 
#> Login to FIS-Broker ... ok. (3.07s) 
#> Getting HTML text from 'https://fbinter.stadt-be...d=navigationFrameResult' ... ok. (1.25s)

overview_atom <- overview[overview$type == "ATOM",]
overview_wfs <- overview[overview$type == "WFS",]
overview_wms <- overview[overview$type == "WMS",]

overview %>%  
  dplyr::count(.data$type) %>% 
  dplyr::arrange(dplyr::desc(.data$n)) %>% 
  DT::datatable()

By Type and Category

overview %>%  
  dplyr::count(
    .data$type,
    .data$category_name
  ) %>% 
  dplyr::arrange(dplyr::desc(.data$n)) %>% 
  DT::datatable()

Types

ATOM

overview_atom %>%
  dplyr::select(
    .data$dataset_id,
    .data$dataset_name,
    .data$type,
    .data$identifier
  ) %>% 
  DT::datatable()

WFS

overview_wfs %>%
  dplyr::select(
    .data$dataset_id,
    .data$dataset_name,
    .data$type,
    .data$identifier
  ) %>% 
  DT::datatable()

WMS

overview_wms %>%
  dplyr::select(
    .data$dataset_id,
    .data$dataset_name,
    .data$type,
    .data$identifier
  ) %>% 
  DT::datatable()

Metadata

Fetch


## Only run on KWB-R Github Actions
metadata_atom <- kwb.fisbroker::read_all_metadata(overview_atom, dbg = FALSE)
#> Creating URLs to info pages ... ok. (0.05s)
metadata_wfs <- kwb.fisbroker::read_all_metadata(overview_wfs, dbg = FALSE)
#> Creating URLs to info pages ... ok. (0.08s)
metadata_wms <- kwb.fisbroker::read_all_metadata(overview_wms, dbg = FALSE)
#> Creating URLs to info pages ... ok. (0.08s)

Export

## Only run on KWB-R Github Actions
kwb.fisbroker::write_to("csv", metadata_atom)
kwb.fisbroker::write_to("json", metadata_atom)

kwb.fisbroker::write_to("csv", metadata_wfs)
kwb.fisbroker::write_to("json", metadata_wfs)


kwb.fisbroker::write_to("csv", metadata_wms)
kwb.fisbroker::write_to("json", metadata_wms)

Details

How do get dataset_id for function kwb.fisbroker::read_wfs() ?

overview <- kwb.fisbroker::get_dataset_overview() 
#> Login to FIS-Broker ... ok. (1.89s) 
#> Getting HTML text from 'https://fbinter.stadt-be...d=navigationFrameResult' ... ok. (1.36s)

kwb.fisbroker:::lookup_dataset_id(
  overview = overview, 
  dataset_id = 3L, 
  type = "WMS"
)
#> [1] "k_adressenberlin"

What happens within get_dataset_overview()?

library(kwb.fisbroker)

response <- login_to_fis_broker() %>%
  compose_fis_broker_url(cmd = "navigationFrameResult") %>%
  httr_get_or_fail()
#> Login to FIS-Broker ... ok. (1.81s)

#open_response(response)

html_tree <- response %>%
  httr::content(as = "text") %>%
  rvest::read_html()

# To be integrated in kwb.fisbroker::get_dataset_overview()...
overview <- kwb.fisbroker:::extract_overview_table(html_tree)

#View(overview)