Learn R Programming

opentraj (version 1.0)

SplitSpLines:

Split Spatial Lines

Description

This function divides an object of class SpatialLines-class defined by the argument [sp.lines] into a number of sub sets of SpatialLines defined by the argument [into].

Usage

# divides the SpatialLines Object into 8 sub sets of SpatialLines SplitSpLines(sp.lines, into)

Arguments

sp.lines
Object of class SpatialLines-class calculated by the function Df2SpLines.
into
Number of times that the sp.lines object must be divided.

Value

Returns a list of SpatialLines Object.

Details

If the number provided by the argument [into] is not multiple of the number of lines in the SpatialLines object, the last element of the list will contain a SpatialLines object with more lines than the first ones. Thus, the original SpatialLines object will not be equally divided.

Although this function might be used seperately, the SplitSpLines function is called by the RasterizeTraj function in order to split the spLines and hence, do the process in parallel.

See Also

SpatialLines-class, Df2SpLines.

Examples

Run this code
## split the SpatialLines object in a list with 8 SpatialLines objects

crs <- "+proj=longlat +datum=NAD83 +no_defs +ellps=GRS80 +towgs84=0,0,0"
air.traj.lines <- Df2SpLines(air.traj, crs)

lines.list <- SplitSpLines(air.traj.lines, 8)

Run the code above in your browser using DataLab