<html><body><div>Hi,</div><div><br></div><div>I'd seeking a way to handle multiple polygon data as a spatial pattern. I know superimpose {spatstat} allows one to superimpose multiple point patterns or line segment patterns, but is there any way to do this for a set of polygon features? Similarly, 'pixellate.owin' {spatstat} allows the user to convert a window to a pixel image by measuring the area of intersection between the windows and each pixel in a raster. But is there a way to do this for a window that contains multiple polygon features?</div><div><br></div><div>To explain, I have a SpatialPolygonsDataFrame (SPDF) with 14 constituent objects. Each polygon represents a different observation window used on different dates. The windows cross-over and overlap within a composite search window. I've managed to coerce the SPDF to an 'owin' in spatstat, and then pixellate it as an 'im' object. But I can't then assign the composite window that I want to this pixel image.</div><div><br></div><div>The multiple feature owin was created from .shp file (readShapePoly) as SpatialPoygonsDataFrame and then as window with <- as(x, "owin"). To prevent error when spatstat.options(checkpolygons=TRUE) "Error in owin(poly = opls) : Polygon data contain overlaps between polygons," I temporarily set checkpolygons=FALSE so that the garbled polygon data could be accepted:</div><div><br></div><div><div>> summary(Bpaths.owin)</div><div>Window: polygonal boundary</div><div>14 separate polygons (no holes)</div><div> vertices area relative.area</div><div>polygon 1 8276 196.270 0.0722</div><div>polygon 2 7536 193.306 0.0712</div><div>polygon 3 8177 193.257 0.0711</div><div>polygon 4 7683 194.428 0.0716</div><div>polygon 5 8144 193.848 0.0714</div><div>polygon 6 7995 193.967 0.0714</div><div>polygon 7 7693 196.711 0.0724</div><div>polygon 8 7904 191.466 0.0705</div><div>polygon 9 7074 191.830 0.0706</div><div>polygon 10 6274 192.397 0.0708</div><div>polygon 11 9189 202.067 0.0744</div><div>polygon 12 6422 192.339 0.0708</div><div>polygon 13 6809 189.818 0.0699</div><div>polygon 14 8095 195.107 0.0718</div><div>enclosing rectangle: [686.7108, 719.9453]x[4886.263, 4926.089]kilometer</div><div>Window area = 2716.81 square kilometer </div><div>Unit of length: 1 kilometer </div></div><div><br></div><div><br></div><div>I also created the composite search window, computed from the geometric union of the constituent polygons in ArcGIS, and read in as a single feature .shp file and then as a single feature owin:</div><div><div><br></div><div><div>> summary(W3)</div><div>Window: polygonal boundary</div><div>single connected closed polygon with 8095 vertices</div><div>enclosing rectangle: [686.7108, 719.9453]x[4886.263, 4926.137]kilometer</div><div>Window area = 526.371 square kilometer </div><div>Unit of length: 1 kilometer </div></div></div><div><br></div><div><br></div><div>I was able to pixellate the multi-polygon 'Bpaths.owin' object on a fine grid;</div><div><br></div><div><div>> summary(Bpaths.pix)</div><div>real-valued pixel image</div><div>600 x 600 pixel array (ny, nx)</div><div>enclosing rectangle: [686.710843032164, 719.945292821527] x [4886.26281350552, 4926.08940155008] kilometer</div><div>dimensions of each pixel: 0.0554 x 0.0664 kilometer </div><div>Image is defined on the full rectangular grid</div><div>Frame area = 1323.61474064852 square kilometer </div><div>Pixel values :</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>range = [0,0.0514739065807758]</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>integral = 9.98891868259874</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>mean = 0.00754669646373897</div></div><div><br></div><div><br></div><div>But what I really want is to assign the correct single-poly, composite window [W3] to this 'im', so that my pixel Image is defined on a subset of the rectangular grid -- set by W3.</div><div><div>Basically I'm trying to convert a multi-feature window to a pixel image by measuring the area of intersection between all the constituent windows in the pattern and each pixel in a raster.</div><div>The impetus is to generate raster data that shows density surface of survey coverage, as this is an integral spatial covariate for the distribution of points in my study.. I know you can perform 'density.ppp' and 'density.psp' for kernel density on points and lines, but haven't been able to find ways to extend this to a pattern of polygons.</div></div><div><br></div><div>Apologies if I'm missing something basic as to why such functionality is either not tenable or feasible??</div><div>Thanks greatly for your patience and help!</div><div>Robin</div><div><br></div><div><br></div><div><br></div></body></html>