Skip to contents

crosswalk_hull_to_hydrofabric_value

Usage

crosswalk_hull_to_hydrofabric_value(hull, river)

Arguments

hull

the model cross section hulls

river

the river streamlines

Value

The representative COMID from nhdplusTools

Details

Used to tie into hydrofabric models

Examples

if (FALSE) { # \dontrun{
if(interactive()){
 #EXAMPLE1
 extrated_pts <- parse_model_to_xyz(geom_path = "./inst/extdata/sample_ras/FEMA-R6-BLE-sample-dataset/12090301/12090301_models/Model/Alum Creek-Colorado River/ALUM 006/ALUM 006.g01",units = "English Units",proj_string = "EPSG:2277",vdat_trans = FALSE,quiet = FALSE)

 ls = sfheaders::sf_linestring(
   obj = extrated_pts[[1]],
   x = "x",
   y = "y",
   linestring_id = "xid",
   keep = FALSE) |> sf::st_set_crs(sf::st_crs("EPSG:6349"))
 ls_final_line_index <- nrow(ls)
 ls_end_index <- nrow(ls)-1
 ls_middle_lines_end <- ls[2:ls_end_index,] |> lwgeom::st_endpoint()
 ls_middle_lines_start <- ls[2:ls_end_index,] %>% lwgeom::st_startpoint()

 df_hull_pts <- rbind(
   sf::st_coordinates(ls[1,]$geometry)[, -c(3)],
   sf::st_coordinates(ls_middle_lines_end),
   apply(sf::st_coordinates(ls[ls_final_line_index,]$geometry)[, -c(3)], 2, rev),
   apply(sf::st_coordinates(ls_middle_lines_start), 2, rev))
 hull = sfheaders::sf_polygon(
   obj = df_hull_pts,
   x = "X",
   y = "Y",
   keep = FALSE) |> sf::st_set_crs(sf::st_crs("EPSG:6349"))

 river <- extrated_pts[[3]]
 current_nhdplus_comid <- crosswalk_hull_to_hydrofabric_value(hull,river)
 }
} # }