View source: R/convert_channel.R
convert_channel | R Documentation |
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
)
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 |
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)
property_names <- c(name="identifier",endNode="endNode",startNode="startNode",length="length")
chn <- convert_channel(vect_lines,property_names)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.