R/convert_channel.R
convert_channel.Rd
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
)
a SpatVect object or a file which can read by terra::vect to create one
a named vector of containing the columns of existing data properties required in the final SpatialPolygonsDataFrame
the width in m to be used for buffering lines to produce polygons
the slope in m/m to be used when none is provided
If the property_names vector contains a width this is used for buffering lines to produce polygons, otherwise the default_width value is used.
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