Look at the spsample function in the sp package.  If you can convert the
information on your contour(s) into a spatial line object, then spsample
can help with choosing random points along that line/contour.  That may
accomplish what you want.


On Wed, Oct 9, 2013 at 5:32 AM, Seth Bigelow <seth@swbigelow.net> wrote:

> Hello all:
>
>
>
> I wish to place sampling plots at regular elevation intervals up a
> mountain.
> Plot centers should be placed at random within a 100 m wide transect along
> the contour. Can anyone suggest an efficient way of doing this? Code below
> places plots on a single transect on the volcano dataset, but does not do
> the 'along the contour' randomization.
>
>
>
> Appreciatively, Seth Bigelow
>
>
>
> library(sp)
>
> library(maptools)
>
> library(rgeos)
>
>
>
> data(volcano)
>
> v.sldf <- ContourLines2SLDF(contourLines(volcano))
>
> t.mtx <- cbind(x=c(1,0.35),y=c(0,0.55))
>
> t.sl <- SpatialLines(list(Lines(Line(t.mtx), ID='1')))
>
> sample.sp <- gIntersection(v.sldf,t.sl)
>
> plot(v.sldf, axes=TRUE)
>
> plot(sample.sp, pch=21,add=T)
>
>
>
> ## End ##
>
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



-- 
Gregory (Greg) L. Snow Ph.D.
538280@gmail.com

	[[alternative HTML version deleted]]

