[R-sig-Geo] build polygons from ellipses, then sample points within the polygons

MacQueen, Don macqueen1 at llnl.gov
Wed Mar 12 18:28:31 CET 2014


If you have the x,y coordinates of an ellipse, you can create a
SpatialPolygons or SpatialPolygonsDataFrame following the example in ?over
(package sp). 

For sampling, see ?spsample

-Don

-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 3/10/14 12:19 PM, "Anthony Fischbach" <afischbach at usgs.gov> wrote:

>I have estimated location error ellipses generated from a continuous-time
>version of the correlated random walk model for animal telemetry data
>(see http://cran.r-project.org/web/packages/crawl/index.html, functions:
>crwMLE and crwPredict).
>>From these error ellipses, I wish to randomly select points.
>Toward this end, I have two questions.
>
>Question 1: Is there a handy function that readily allows creation of
>polygons from ellipses?
>## toy example
>ellipses<-data.frame(x=c(251753, 252966, 254179),
>						y=c(343394, 343315, 343237),
>						majorAxis=c(0.0, 2753.5, 2114.8),
>						minorAxis=c(0.0,  2754.1, 2118.0),
>						angle=c(0,0,0)) ## dataFrame with Ellipse information
>						## in this case the majorAxis is assumed to lie along the x axis
>                                                ## x, y define the
>centroid
>of the ellipse.
>coordinates(ellipses) <- x~y  ## cast to a spatialPointsDataFrame
>ellipses.poly <-
>Wonder.function.that.Makes.spatialPolygons.from.ellipses(ellipses)
>
>Question 2:  I know that there is a handy means to randomly generate
>locations from within a SpatialPolygon.  Please help me find it.
>
>
>
>-----
>Tony Fischbach, Wildlife Biologist
>Walrus Research Program
>Alaska Science Center
>U.S. Geological Survey
>4210 University Drive
>Anchorage, AK 99508-4650
>
>AFischbach at usgs.gov
>http://alaska.usgs.gov/science/biology/walrus
>--
>View this message in context:
>http://r-sig-geo.2731867.n2.nabble.com/build-polygons-from-ellipses-then-s
>ample-points-within-the-polygons-tp7585922.html
>Sent from the R-sig-geo mailing list archive at Nabble.com.
>
>_______________________________________________
>R-sig-Geo mailing list
>R-sig-Geo at r-project.org
>https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list