NEWS.md
nhdplusTools r package to gain access to USGS Network Linked Data Index (NLDI) services.pt_watershed_area function to retrieve delineated watersheds from NHDPlus via the NLDI.pt_watershed_area function into the processing steps for cross sections to identify NHD reaches (reachcode, comid) and calculate upstream drainage basin areas.Added several functions to support use in Shiny web apps:
dem2rem function to detrend to support the return of both an rem and trend surface. Trend surfaces can be used to model water surfaces.water_surface_area - Derive a polygon representing the water surface area at a specified rem elevation. Eliminates disconnected off-channel areas and simplifies the geometry. Used to create channel_poly and floodplain_poly sf objects.xs_pts_classify - Classifies cross_section_points as falling in the channel and floodplain.hydroflatten_dem - Uses a trend surface to add a water surface to a dem.floodplain_volume - Calculates the volume between two surfaces, such as a DEM and water surface.Updated the detrend function to not extend the interpolated trend surface beyond the extent of the input flowline_points. This was required to prevent extrapolation of the surface at each end of the reach beyond the available input data. In many cases, this extrapolation was distorting the trend surface at each end of the reach.
** Minor changes * Updated get_dem to enable multiple threads for download.
terra::SpatRaster object corruption. Was getting error: “expansion is not yet allowed” when nothing seemed to be wrong with the extent, crs, or resolution of the object.Start using the new data package FluvialGeomorph/fluvgeodata for testing newly added functions.
Added new functions to support fluvgeo use in shiny apps:
flowline - Create a valid flowline object from raw linework.flowline_points - Create a valid flowline_points object from a flowline object.cross_section - Create a valid cross_section object from raw linework.cross_section_points - Create a valid cross_section_points object from a cross_section object.dem2rem - Convert a DEM to an REM.get_dem - Get a DEM from the latest ESRI terrain image server.get_leaflet - Get a basic leaflet object.get_results_leaflet - Get a leaflet objet with fluvgeo objects.get_terrain_leaflet - Get a leaflet object with a DEM.arcgis_auth - Authorize to an AGOL service.check_crs_3857 - Check if sf or terra objects are CRS 3857.sf_fix_crs - Fix sf objects that might have mis-specified CRS’s 3857 and 4326.sf_get_z - Get z value from an elevation model for an sf object.Updated reports to use a series of new functions to improve data quality and labeling.
Added a series of functions to streamline the editing and drawing of cross sections in the sf format.
start_left - Determines if a cross section starts to the left of the flowline.sf_line_end_point - Returns the x,y corrdinates of the start or end of a line.sf_point_attributes - Write the x and y coordinate values into columns.xs_upstream - Determine the upstream cross section and write its vlues into new columns. * xs_bearing - Calculate the bearing of a cross section.Converted all functions to tmap version 4 (well, v3.99).
Discovered that the arcgisbinding::arc.open function now no longer works reliably (see issue #91).
Removed all remaining dependencies on the ESRI arcgisbinding R package as many of its primary IO functions are no longer reliably working. Removed remaining functions that relied on arc.open or arc.write:
arc_raster2SpatRaster replaced by gdb_raster2SpatRast
arc2sf replaced by fc2fs
get_arc_wktsf2arc_tablesf2arcDiscovered that the GDAL v3.7+ OpenFileGDB driver can now read rasters.
The terra package for rasters is currently bundled with > GDAL 3.7
> terra::gdal()
[1] "3.9.3"
>terra::gdal(drivers = TRUE) |> filter(name == 'OpenFileGDB')
name raster vector can vsi long.name
1 OpenFileGDB TRUE TRUE read/write TRUE ESRI FileGDB
arcgisbindings.fig_xs_profiles function into two functions, each specialized for either L1 or L2 reports. These figures were made more compact to ensure they fit on a single page.xs_compare_plot_L1 and xs_compare_plot_L2 functions to be more compact.table_xs_dimensions that returns a gtable object of hydraulic dimensions for a cross section.level_1_report_b to enable a modification of the level 1 workflow and improve cross section figures.fig_xs_profiles figure to more compactly represent individual cross section maps and their plots.map_xs function to map the channel and floodplain polygons instead of the banklines line feature class.xs_compare_plot_L1 function to support filtering of cross section station locations to either all, floodplain, or channel.xs_geometry previously calculated the maximum cross section depth and was changed to calculate the mean depth of each cross section. This change was made to better align with the hydraulic geometry literature.slope_sinuosity function to optionally smooth the flowline_points z-elevations. As the quality of LiDAR data collection continually increases, there is less need to smooth longitudinal profile z-elevations.sp package ahead of its decommissioning in favor of the R package sf. This included converting all package data, tests, checks, and documentation.rgdal to address issues with the Level 1 Reports failing. See Issue 26
terrainr get_tiles function to address ceramic display issues for background elevation imagery in reports. See Issue 20
maptiles get_tiles function to address ceramic display issues for aerial imagery in reports. See Issue 20
sx2arc_table function to write sf and sp objects to a file geodatabase table.Discovered that arcgisbinding::arc.write frequently fails writing feature classes to a geodatabase. “Wild caught” file geodatabase feature classes produced by the FluvialGeomorph-toolbox when converted to sp or sf inside fluvgeo frequently fail to create a valid feature class (i.e., missing geometry, no coordinate system) when saved to a file geodatabase using arc.write.
This behavior is described in the arcgisbinding issues listed below. These outstanding issues identify and generally discuss the problems, but provide no fix or clear workaround guidance.
The workarounds identified in these issues were implemented in the sp2arc and sf2arc functions. No combination of these suggestions were able to produce a reliable workaround.
Since no comprehensive solution is currently being provided for these issues in arc.write, we have chosen to minimize our exposure. We have decided to only write table data back to the file geodatabase.
If the arcgisbinging team addresses these issues, we may choose to go back to trusting the writing of file geodatabase feature classes using arc.write.
arcgisbinding failure to comprehensively handle coordinate reference system conversions between ESRI-GDAL-ESRI. The workaround is to require the user to read and write geodatabase (GDB) feature classes into a feature dataset. The feature dataset then enforces the coordinate reference system.arcgisbinding recommendation to handle coordinate reference system conversions between ESRI-GDAL/PROJ6-ESRI using the arc.write() shape_info method does not work, Issue 38.arcgisbinding issue 26 & 38) (https://github.com/R-ArcGIS/r-bridge/issues/38)[https://github.com/R-ArcGIS/r-bridge/issues/38].xs_metrics_report).map_xs to the Level 1 and Estimate Bankfull reports.map_xs optional to support its use in the Level 1 report and the Estimate Bankfull report before banklines are created.esri_raster2RasterLayer function to standardize raster retrieval.xs_compare_plot_L1 into the plot area to be consistent with the level 2 plots.xs_compare_plot_* to more clearly communicate the orientation of the cross section.map_xs function to accept a raster::RasterLayer so that the site DEM is only loaded once rather than being loaded each time the map_xs function is called.xs_metrics_plot_L1, xs_metrics_plot_L2, compare_xs_long_profile, xs_long_profile, xs_profile_plot, map_reach_metric, xs_metric_plot.map_reach_overview function to use aerial photos and coarse-scale elevation from Mapbox. This functionality is provided by the ceramic R package. Use of Mapbox requires an API key to access a relatively generous free tier of mapping services.map_reach_overview to use the ceramic R package to retrieve Mapbox aerial photos and coarse-scale elevation in place of the broken tmaptools::read_osm.map_xs function now handles inputs in different coordinate systems. It does this by reprojecting all inputs to match the dem.flowline_metrics function that plots Level 1 metrics.map_xs function is called in a report.xs_metrics_report.Level 2 Report.xs_metrics_plot_2 for the Level 2 Report that only displays xs metrics complete at Level 2.sf objects in addition to sp objects. sf` R package for spatial data.