File: nearestPointOnLine.Rd

package info (click to toggle)
r-cran-maptools 1%3A1.0-2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,968 kB
  • sloc: ansic: 3,022; makefile: 5; sh: 4
file content (36 lines) | stat: -rw-r--r-- 871 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
\name{nearestPointOnLine}
\alias{nearestPointOnLine}
\title{
Get the nearest point on a line to a given point
}
\description{
This function calculates the coordinates of the nearest point on a line to a 
given point. This function does not work with geographic coordinates.
}
\usage{
nearestPointOnLine(coordsLine, coordsPoint)
}
\arguments{
  \item{coordsLine}{
Matrix with coordinates of line vertices. Each row represents a vertex. 
}
  \item{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.
}
\author{
German Carrillo
}
\seealso{
\code{\link{nearestPointOnSegment}}, \code{\link{snapPointsToLines}} 
}
\examples{
coordsLine = cbind(c(1,2,3),c(3,2,2))
coordsPoint = c(1.2,1.5)
nearestPointOnLine(coordsLine, coordsPoint)
}
\keyword{ spatial }