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

Shaofei Chen shaofei.chen at utdallas.edu
Tue Sep 8 20:39:22 CEST 2009


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

Shaofei

-----Original Message-----
From: Edzer Pebesma [mailto:edzer.pebesma at uni-muenster.de] 
Sent: Tuesday, September 08, 2009 1:09 AM
To: Shaofei Chen
Cc: r-sig-geo at stat.math.ethz.ch
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(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