knitr::opts_chunk$set(echo = TRUE, message = FALSE) library(dm) library(DBI) library(sf)
cs_dm = list( flowlines = data.frame( hy_id = integer(1L), geometry = numeric(1L) ), transects = data.frame( hy_id = integer(1L), cs_source = character(1L), cs_id = integer(1L), cs_measure = numeric(1L), cs_length = numeric(1L), geometry = numeric(1L) ), cs_pts = data.frame( hy_id = integer(1L), cs_id = integer(1L), pt_id = integer(1L), pt_measure = numeric(1L), relative_dist = numeric(1L), X = numeric(1L), Y = numeric(1L), Z = numeric(1L), Z_source = character(1L), roughness = numeric(1L) ) ) usethis::use_data(cs_dm, overwrite = TRUE) meta = tibble::tribble( ~Attribute, ~Description, "hf_id", "A hydrofabric specfic, globaly unique flowpath/flowline identifier", "geometry", "Simple Features Geometry (LINESTRING)", "cs_source", "Source of transect information", "cs_id", "Identifier, unique to a hy_id, that increases from the inlet to the outlet", "cs_measure", "Percent along the flowpath from outlet", "cs_length", "Width (in meters) of cross section transect", 'pt_id', "Identifier, unique to cs_id, that increases from left band to right bank", 'pt_measure', "Percent along the transect from left bank (0-1)", 'relative_dist', "Distance of cs_id, starting at 0, in meters", 'X', "X coordinate in CRS of geometry", 'Y', "Y coordinate in CRS of geometry", 'Z', "Z coordinate (in meters) in CRS of geometry", 'Z_source', "Source of elevation data", 'roughness', "(Optional) Estimated Manning's Roughness value" ) dm = dm::dm(flowlines = cs_dm$flowlines, transects = cs_dm$transects, cs_pts = cs_dm$cs_pts) %>% dm_add_pk(flowlines, hy_id) %>% dm_add_pk(transects, cs_id) %>% dm_add_pk(cs_pts, pt_id) %>% dm_set_colors(red = flowlines, red = transects, grey = cs_pts) df = data.frame(names = names(unlist(cs_dm))) %>% tidyr::separate(names, sep = "[.]", into = c('layer', 'Attribute')) %>% group_by(Attribute) %>% summarise(layers = paste(layer, collapse = ", ")) meta = left_join(meta, df, by = "Attribute")
r Sys.Date()
)dm_draw(dm, view_type = "all", column_types = TRUE, rankdir = "LR")
DT::datatable(meta, options = list(pageLength = 35, dom = 't'), rownames = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.