nearestPointOnLine

0th

Percentile

Get the nearest point on a line to a given point

This function calculates the coordinates of the nearest point on a line to a given point. This function does not work with geographic coordinates.

Keywords
spatial
Usage
nearestPointOnLine(coordsLine, coordsPoint)
Arguments
coordsLine

Matrix with coordinates of line vertices. Each row represents a vertex.

coordsPoint

A vector representing the X and Y coordinates of the point.

Value

Vector with the X and Y coordinates of the nearest point on a line to the given point.

See Also

nearestPointOnSegment, snapPointsToLines

Aliases
  • nearestPointOnLine
Examples
# NOT RUN {
coordsLine = cbind(c(1,2,3),c(3,2,2))
coordsPoint = c(1.2,1.5)
nearestPointOnLine(coordsLine, coordsPoint)
# }
Documentation reproduced from package maptools, version 0.9-5, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.