Thank you very much. It works for me now. Previously I only looked at the
spatstat package.

Shaofei

-----Original Message-----
From: Edzer Pebesma [mailto:[email protected]] 
Sent: Tuesday, September 08, 2009 1:09 AM
To: Shaofei Chen
Cc: [email protected]
Subject: Re: [R-sig-Geo] How to achieve the boundary of a polygon?

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(bo...@bbox[1],bo...@bbox[3],bo...@bbox[2],bo...@bbox[4])))
>
> Can you help me sample them inside the boundary?
> Thanks!
>
> Best,
> Shaofei
>       [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [email protected]
> 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 [email protected]

_______________________________________________
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to