[R-sig-Geo] How to achieve the boundary of a polygon?

Edzer Pebesma edzer.pebesma at uni-muenster.de
Tue Sep 8 08:09:06 CEST 2009


Have you had a look at spsample in package sp?

Shaofei Chen wrote:
> Hi,
>
> I want to randomly sample some points within a polygon. After reading the bounday file to the SpatialPolygonsDataFrame, I found that I can only sample them in the rectangular containing the polygon based on bbox.
>
> bound <- readShapePoly("bound.shp") 
> plot(bound)
> rand.points=rpoint(100, win=as.owin(c(bound at bbox[1],bound at bbox[3],bound at bbox[2],bound at bbox[4])))
>
> Can you help me sample them inside the boundary?
> Thanks!
>
> Best,
> Shaofei
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>   

-- 
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de/
http://www.springer.com/978-0-387-78170-9 e.pebesma at wwu.de



More information about the R-sig-Geo mailing list