Message-ID: <fdee9b21-c0fe-efce-93ab-a398d05a4841@me.com>
Date: 2011-05-30T20:40:59Z
From: Robin W Hunnewell
Subject: pixellating multiple polygon data
Hi,
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?
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.
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:
> summary(Bpaths.owin)
Window: polygonal boundary
14 separate polygons (no holes)
?? ? ? ? ? ?vertices ? ?area relative.area
polygon 1 ? ? ? 8276 196.270 ? ? ? ?0.0722
polygon 2 ? ? ? 7536 193.306 ? ? ? ?0.0712
polygon 3 ? ? ? 8177 193.257 ? ? ? ?0.0711
polygon 4 ? ? ? 7683 194.428 ? ? ? ?0.0716
polygon 5 ? ? ? 8144 193.848 ? ? ? ?0.0714
polygon 6 ? ? ? 7995 193.967 ? ? ? ?0.0714
polygon 7 ? ? ? 7693 196.711 ? ? ? ?0.0724
polygon 8 ? ? ? 7904 191.466 ? ? ? ?0.0705
polygon 9 ? ? ? 7074 191.830 ? ? ? ?0.0706
polygon 10 ? ? ?6274 192.397 ? ? ? ?0.0708
polygon 11 ? ? ?9189 202.067 ? ? ? ?0.0744
polygon 12 ? ? ?6422 192.339 ? ? ? ?0.0708
polygon 13 ? ? ?6809 189.818 ? ? ? ?0.0699
polygon 14 ? ? ?8095 195.107 ? ? ? ?0.0718
enclosing rectangle: [686.7108, 719.9453]x[4886.263, 4926.089]kilometer
Window area = ?2716.81 square kilometer?
Unit of length: 1 kilometer?
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:
> summary(W3)
Window: polygonal boundary
single connected closed polygon with 8095 vertices
enclosing rectangle: [686.7108, 719.9453]x[4886.263, 4926.137]kilometer
Window area = ?526.371 square kilometer?
Unit of length: 1 kilometer?
I was able to pixellate the multi-polygon 'Bpaths.owin' object on a fine grid;
> summary(Bpaths.pix)
real-valued pixel image
600 x 600 pixel array (ny, nx)
enclosing rectangle: [686.710843032164, 719.945292821527] x [4886.26281350552, 4926.08940155008] kilometer
dimensions of each pixel: 0.0554 x 0.0664 kilometer?
Image is defined on the full rectangular grid
Frame area = ?1323.61474064852 square kilometer?
Pixel values :
range = [0,0.0514739065807758]
integral = 9.98891868259874
mean = 0.00754669646373897
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.
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.
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 'densityppp' 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.
Apologies if I'm missing something basic as to why such functionality is either not tenable or feasible??
Thanks greatly for your patience and help!
Robin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20110530/80eb8f88/attachment.html>