[R-sig-Geo] Clipping/Subsetting Sp objects (was no subject)

Andy Bunn abunn at whrc.org
Fri Apr 7 02:04:13 CEST 2006


Hi Tim, I'm reposting b/c I forgot to include a subject line before (fried).
I'll revisit this tomorrow. 
Thx,
-Andy

-----Original Message-----
From: Tim Keitt [mailto:tkeitt at mail.utexas.edu] 
Sent: Thursday, April 06, 2006 5:19 PM
To: Andy Bunn
Cc: r-sig-geo at stat.math.ethz.ch
Subject: Re: [R-sig-Geo] (no subject)


We need R wrappers for:

http://www.vividsolutions.com/jts/jtshome.htm

or

http://geos.refractions.net/

My preference would be the latter.

THK

On Thu, 2006-04-06 at 16:38 -0400, Andy Bunn wrote:
> List,
> 
> I want to clip (subset) an sp object SpatialGridDataFrame using a 
> polygon. For instance in this example I want to create a new object of 
> class SpatialGridDataFrame that is clipped to the area inside the 
> polygon on the map.
> 
>   data(meuse.grid)
>   coordinates(meuse.grid) <- ~x+y
>   gridded(meuse.grid) <- T
>   x = as(meuse.grid, "SpatialGridDataFrame")
>   clip <- cbind(x=c(180000,180000,180500,180500,180000),
>                 y=c(330500,331000,331000,330500,330500))
>   image(x, "dist")
>   polygon(clip)
>   # y = x[...clip?]
> 
> 
> How can I go about it?
> 
> Thanks in advance, Andy
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch 
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
-- 
Timothy H. Keitt
Assistant Professor
http://www.keittlab.org/ http://www.utexas.edu/directory/index.php?q=Keitt




More information about the R-sig-Geo mailing list