Learn R Programming

tmap (version 0.7)

map_points_to_line: Map points to line

Description

Map points to a polyline. For each point, the closest point on the line and the corresponding distance is determined. At the moment, it only considers the begin- joint-, and endpoint coordinates of a line, not their interpolations. To take the interpolations into account, use split_lines_equal. (Experimental, see note)

Usage

map_points_to_line(shp.points, shp.lines, by.key = FALSE, key.points = NULL,
  key.lines = NULL)

Arguments

shp.points
shape object containing the points, i.e. a SpatialPoints(DataFrame)
shp.lines
shape object containing the polylines, i.e. a SpatialLines(DataFrame)
by.key
should the points be mapped to the polylines by class (determined by key.points and key.lines)?
key.points
name of a variable contained in shp.points that determined the classes of the points. The points are mapped to the polylines class-wise.
key.lines
name of a variable contained in shp.lines that determined the classes of the polylines. The points are mapped to the polylines class-wise.

Value

  • data.frame, where the rows correspond to the points. The columns are: 1) id1, which is the Lines identifier in which the coordination point is contained, 2) id2, which is the Line identifier in which the coordination point is contained, 3) id3, which is the number of the closest coordination point in the polyline, 4) the distance with the closest coordination point.