Learn R Programming

rsgeo (version 0.1.7)

closest_point: Find Closest Point

Description

For a given geometry, find the closest point on that geometry to a point. The closest point may be an intersection, a single point, or unable to be determined.

Usage

closest_point(x, y)

closest_point_haversine(x, y)

Value

An rs_POINT vector

Arguments

x

an object of class rsgeo

y

an object of class rs_POINT

Examples

Run this code
x <- geom_linestring(1:100, runif(100, 0, 90), rep.int(1:10, 10))
y <- geom_point(runif(10, 0, 90), rnorm(10, 1, 90))
closest_point(x, y)
closest_point_haversine(x, y)

Run the code above in your browser using DataLab