Learn R Programming

secrlinear (version 1.0.3)

edges: Interactive Edge Edit

Description

A `skip' is defined here as a graph edge between two input lines. Many skips are legitimate, but some `shortcut' skips are artefacts of the simple algorithm used by asgraph to construct the graph topology. These are better removed. These functions allow skips in a linearmask to be visualised and edited. addedges may be used to bridge artefactual gaps in a network, or to correct editing mistakes. The edge weight of a new edge is its Euclidean length.

Usage

showedges(mask, plt = TRUE, add = FALSE, type = c('all', 'noskips', 'skips'), 
                       lengths = c(0,Inf), ...)

replot(mask, xlim = NULL, ylim = NULL, ...)

addedges(mask, replot = TRUE, ...)

deleteedges(mask, replot = TRUE, ...)

cleanskips(mask)

Arguments

mask
linearmask object with 'graph' attribute
lengths
numeric vector of minimum and maximum edge length (weight)
plt
logical; if TRUE the edges are plotted
add
logical; if TRUE the edges will be added to an existing plot
type
character value for subset of edges to show
xlim
vector of min and max x-values for new plot
ylim
vector of min and max y-values for new plot
replot
logical; if TRUE the plot will be re-done using replot
...
other arguments (see details)

Value

  • showedges returns a dataframe with one row for each edge, and columns --
  • startindex of start vertex
  • finishindex of finish vertex
  • line1line number of start
  • line2line number of finish
  • x1geographic coordinates of start
  • y1geographic coordinates of start
  • x2geographic coordinates of finish
  • y2geographic coordinates of finish
  • weight"weight" attribute of edge (its length in metres)
  • The dataframe is returned invisibly if plt = TRUE. cleanskips returns a linearmask object. replot returns NULL. addedges and deleteedges invisibly returns a linear mask object with updated graph attribute.

Details

showedges is a general-purpose function for displaying or extracting edge information from the graph attribute of a linear mask. cleanskips removes any between-line `skips' that are longer than the shortest `skip'. Other functions here are used to manually edit a mask graph. replot is used to zoom in on part of a linear mask (often to inspect `skips'). The dots argument ...is passed by replot to plot.linearmask and by addedges and deleteedges to showedges (if replot = TRUE).

See Also

linearmask, getLineID

Examples

Run this code
setwd(system.file("extdata", package = "secrlinear"))
tempmask <- read.linearmask(file = "silverstream.shp", spacing = 50)

## show all edges
plot(tempmask, linecol = 'white')
tmp <- showedges(tempmask, add = TRUE)

## select a rectangular area to zoom in
replot(tempmask)

## click on the vertices of one or more edges to delete or add
tempmask <- deleteedges(tempmask)
tempmask <- addedges(tempmask)

Run the code above in your browser using DataLab