[R-sig-Geo] Converting a line feature to evenly spaced points
Barry Rowlingson
b.rowlingson at lancaster.ac.uk
Fri Jul 8 21:18:57 CEST 2011
On Fri, Jul 8, 2011 at 8:04 PM, Ezra Boyd <eboyd3 at tigers.lsu.edu> wrote:
> Hi Everyone,
>
> I have a line feature that represents a road/trail along with a set of
> GPS points taken along the trail. What I need to do is calculate the
> distance along the pathway from the trailhead to each GPS point. The
> best way that I can think of to accomplish this is to convert the line
> feature to evenly spaced points (preferably 1 meter or 1 foot apart.)
> However, all of the line-to-point conversion tools that I have found
> simply create the points based on the nodes of the line feature. But, this
> won't help me because I know that the nodes are not evenly spaced.
> Does anyone know of a line-to-point conversion tool that creates
> evenly spaced points? Otherwise, does anyone have other ideas of how
> I can accomplish what I need to accomplish?
spsample(sl, 10, "regular")
will, if sl is SpatialLine*, produce 10 equally distanced points
along the line - not necessarily at the nodes.
However, you cant control how far apart they are. You do know the total length:
SpatialLinesLengths(sl)
so can get something approximate with a bit of clever division.
Possibly delving into the internals of spsample methods will point
the way to making it do exactly what you want...
Barry
More information about the R-sig-Geo
mailing list