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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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)

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).

Value

showedges returns a dataframe with one row for each edge, and columns –

start

index of start vertex

finish

index of finish vertex

line1

line number of start

line2

line number of finish

x1

geographic coordinates of start

y1

geographic coordinates of start

x2

geographic coordinates of finish

y2

geographic 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.

See Also

linearmask, getLineID

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 

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)


## End(Not run)