Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

misc-gNearestPoints

Closest Points of two Geometries


Description

Return closest points of two geometries.

Usage

gNearestPoints(spgeom1, spgeom2)

Arguments

spgeom1, spgeom2

sp objects as defined in package sp.

Value

The closest points of the two geometries or NULL on exception. The first point comes from spgeom1 geometry and the second point comes from spgeom2.

Author(s)

Rainer Stuetz

See Also

gDistance

Examples

g1 <- readWKT("MULTILINESTRING((34 54, 60 34), (0 10, 50 10, 100 50))")
g2 <- readWKT("MULTIPOINT(30 0, 100 30)")
plot(g1, pch=4, axes=TRUE)
plot(g2, add=TRUE)
plot(gNearestPoints(g1, g2), add=TRUE, col="red", pch=7)
gDistance(g1, g2)

rgeos

Interface to Geometry Engine - Open Source ('GEOS')

v0.5-5
GPL (>= 2)
Authors
Roger Bivand [cre, aut] (<https://orcid.org/0000-0003-2392-6140>), Colin Rundel [aut], Edzer Pebesma [ctb], Rainer Stuetz [ctb], Karl Ove Hufthammer [ctb], Patrick Giraudoux [ctb], Martin Davis [cph, ctb], Sandro Santilli [cph, ctb]
Initial release
2020-09-01

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.