[R-sig-Geo] convert from spatstat to sp

Turner Rolf r.turner at auckland.ac.nz
Sat Oct 30 00:23:23 CEST 2010


________________________________________
From: r-sig-geo-bounces at stat.math.ethz.ch [r-sig-geo-bounces at stat.math.ethz.ch] On Behalf Of Peter Larson [pslarson2 at gmail.com]
Sent: Saturday, 30 October 2010 8:28 a.m.
To: r-sig-geo at stat.math.ethz.ch
Subject: [R-sig-Geo] convert from spatstat to sp

Hello all,

Is there any way to convert from spatstat to sp?

Specifically, I am looking to clip a density plot produced in spatstat
to include only points within a polygon boundary in a shapefile. if
there is a way to clip in spatstat, this would also be acceptable.

Clipping in spatstat is done simply using [] --- let X be your density plot (image; object of class "im")
and let W be an object of class owin determined by the polygonal boundary that you have in mind.

Just do

    Y <- X[W]

to get X clipped to the window W.  To find out how to make ``a polygon boundary in a shapefile'' into
a window, see the vignette on handling shapefiles in spatstat:

    vignette("shapefiles")

        cheers,

              Rolf Turner


More information about the R-sig-Geo mailing list