Converts SpatialLinesDataFrame or SpatialPolygonsDataFrame to the correct format of SpatialPolygonsDataFrame for dynatopGIS.

convert_channel(
  vect_object,
  property_names = c(name = "DRN_ID", length = "length", startNode = "startNode", endNode
    = "endNode", width = "width", slope = "slope"),
  default_width = 2,
  default_slope = 0.001
)

Arguments

vect_object

a SpatVect object or a file which can read by terra::vect to create one

property_names

a named vector of containing the columns of existing data properties required in the final SpatialPolygonsDataFrame

default_width

the width in m to be used for buffering lines to produce polygons

default_slope

the slope in m/m to be used when none is provided

Details

If the property_names vector contains a width this is used for buffering lines to produce polygons, otherwise the default_width value is used.

Examples

channel_file <- system.file("extdata", "SwindaleRiverNetwork.shp",
package="dynatopGIS", mustWork = TRUE)
vect_lines <- terra::vect(channel_file)
#> Warning: [vect] Z coordinates ignored
property_names <- c(name="identifier",endNode="endNode",startNode="startNode",length="length")
chn <- convert_channel(vect_lines,property_names)
#> Warning: Modifying to spatial polygons using default width
#> Warning: Adding default slope