sss.line: Draw a Simple Systematic Sample (SSS) from a linear resource.

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/sss.line.r

Description

Draws a systematic sample from a SpatialLines* object. The SpatialLines* object represents a 2-dimensional line resource, such as a river, highway, or coastline.

Usage

1
sss.line(x, n, spacing, random.start = TRUE)

Arguments

x

A SpatialLines or SpatialLinesDataFrame object. This object must contain at least 1 line.

n

Sample size. Number of points to draw from the set of all lines contained in x. Specification of n takes precedence over specification of spacing.

spacing

Assuming, n is not given, this is the distance between sample points on the amalgamated line in x. For example, if x is projected in UTM coordinates and spacing=100, the returned sample has one point every 100 meters along the amalgamated line in x. Keep in mind that the start of line i+1 in x may not coincide with the end of line i in x, and that lines in x may not be straight. Thus, 2-dimensional distances between sample points will not, in general, equal spacing.

random.start

Whether to start the sequence of points at a random place. If TRUE, a random uniform variate is selected between 0 and either spacing or (length/n) and the first location is placed at that location along the line. Subsequent points occur every spacing units along the lines. If random.start==FALSE, the first sample point occurs at 0 (first vertex of the lines).

Details

If x contains multiple lines, the lines are amalgamated before sampling. Conceptually, under amalgamation the lines in x are "stretched" straight and laid end-to-end in order of appearance in x. The simple systematic sample is then drawn from the amalgamated line. Finally, sample points on the amalgamated line are mapped back to 2-dimensional space to fall on the lines in x.

Note that spacing between sample points is enforced on the amalgamated line, and may not look correct if the lines loop back on themselves. For example, consider a line tracing a circle. The spacing between the first and last sample point along the circle will not be the prescribed spacing because the circle starts between them. Spacing of all other points (2 to n-1) will be as requested.

Value

A SpatialPointsDataFrame containing locations in the SSS sample, in order along the amalgamated line. Those on line 1 appear first, those on line 2 second, etc. Attributes of the sample points (in the embedded data frame) are as follows:

Additional attributes of the output object, beyond those which make it a SpatialPointsDataFrame, are:

Author(s)

Trent McDonald

See Also

sss.polygon, sss.point, sdraw

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Draw fixed number of equi-distant points
HI.samp <- sss.line( HI.coast, 100 )   
plot( HI.coast, col=rainbow(length(HI.coast)) )
points( HI.samp, col="red", pch=16 )

# Draw points every 20 km along Hawaii's coastline
HI.samp <- sss.line( HI.coast, spacing=20000 )   
plot( HI.coast, col=rainbow(length(HI.coast)) )
points( HI.samp, col="red", pch=16 )

# Inspect attributes of points with HI.samp@data

SDraw documentation built on July 8, 2020, 6:23 p.m.