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

Anthony Fischbach afischbach at usgs.gov
Mon Mar 10 20:19:11 CET 2014


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-sample-points-within-the-polygons-tp7585922.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list