gDefrag (version 0.1)

edge.creation: Creating graph edges

Description

Generates the graph edges, connecting nodes that are the landscape polygons resulting from the landscape clip by the road network.

Usage

edge.creation(nodes, land_polyg, min_length = 0, 
min_pol_area = 0, plot = TRUE, shape = FALSE, 
shape_name_edges = "shape_edges")

Arguments

nodes

Output of the function node.creation.

land_polyg

SpatialPolygonsDataFrame loaded with readOGR function of the package rgdal (polygon shapefile).

min_length

Minimum length of the road segment to consider creating an edge representing it.

min_pol_area

Minimum area for a given polygon to be considered a node.

plot

Plot after running? (TRUE/FALSE).

shape

Create a shapefile with the edges (TRUE/FALSE).

shape_name_edges

Name of the edges shapefile to be created (without prioritization).

Value

The function returns a SpatialLinesDataFrame with the edges. The data table of this data frame has the following fields:

  • node_A - Node A Id.

  • node_B - Node B Id.

  • distance - Euclidean distance between nodes A and B (edge length).

  • x_node_A - Node A longitude.

  • y_node_A - Node A latitude.

  • x_node_B - Node B longitude.

  • y_node_A - Node A latitude.

  • raster_value_A - Average value of the underlying raster in the polygon represented by node A.

  • raster_value_B - Average value of the underlying raster in the polygon represented by node B.

  • road_ID - Id of the road represented by the edge.

  • road_length - Length of the road represented by the edge.

Details

If shape = TRUE, this function produces one shapefile with edges without prioritization metrics.

See Also

node.creation

Examples

Run this code
# NOT RUN {
data(road_P)

out1 <- node.creation(land_polyg=road_P, value_col = "forest_sum", scale_nodes = 10, 
col_nodes = "pink", cex_labels = 0.7)

out2 <- edge.creation(nodes = out1, land_polyg = road_P, min_length = 0, 
min_pol_area = 0, plot = FALSE)

# }

Run the code above in your browser using DataLab