Learn R Programming

opentraj (version 1.0)

Df2SpLinesDf:

Data Frame to Spatial Lines Data Frame

Description

This function converts an object of class SpatialLines-class, calculated by the function Df2SpLines, into an Object of class SpatialLinesDataFrame.

Usage

Df2SpLinesDf(spLines, df, add.distance=F, add.azimuth=F)

Arguments

spLines
Object of class SpatialLines-class calculated by the function Df2SpLines.
df
data.frame Object created by the function ProcTraj.
add.distance
Logical: If True, it will calculate and include the distance in meters between the first and last point for every line.
add.azimuth
Logical: If True it will calculate and include the azimuth for every line.

Value

Returns an object of class SpatialLinesDataFrame.

Details

Because the additional information carried by the SpatialLinesDataFrame Object have to be a data frame with same number of lines as the number of lines in the SpatialLines Object, the additional information, which each line of the SpatialLinesDataFrame will have, concerns to the first row of an individual trajectory from the data frame calculated by the function ProcTraj

See Also

Df2SpLines, ProcTraj, SpatialLines-class, data.frame.

Examples

Run this code
  crs <- "+proj=longlat +datum=NAD83 +no_defs +ellps=GRS80 +towgs84=0,0,0"
  air.traj.lines <- Df2SpLines(air.traj, crs)
  air.traj.linesDf <- Df2SpLinesDf(air.traj.lines, air.traj)
  PlotTraj(air.traj.linesDf)

Run the code above in your browser using DataLab