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

linref-gProject

Project Points to Line Geometry


Description

Return distances along geometry to points nearest the specified points.

Usage

gProject(spgeom, sppoint, normalized = FALSE)

Arguments

spgeom

SpatialLines or SpatialLinesDataFrame object

sppoint

SpatialPoints or SpatialPointsDataFrame object

normalized

Logical determining if normalized distances should be used

Details

If normalized=TRUE, distances normalized to the length of the geometry are returned, i.e., values between 0 and 1.

Value

a numeric vector containing the distances along the line to points nearest to the specified points

Author(s)

Rainer Stuetz

See Also

gInterpolate

Examples

l <- readWKT("LINESTRING(0 1, 3 4, 5 6)")
p1 <- readWKT("MULTIPOINT(3 2, 3 5)")
frac <- gProject(l, p1)
p2 <- gInterpolate(l, frac)
plot(l, axes=TRUE)
plot(p1, col = "blue", add = TRUE)
plot(p2, col = "red", add = TRUE)

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.