[R-sig-Geo] pixellate.owin when "owin" contains separate, overlapping polygons

Robin W Hunnewell rhunne at mac.com
Tue May 31 18:25:58 CEST 2011


Dear R-sig Geo listers,

sorry for my longwinded post, maybe I could try again.. 

I've used pixellate.owin() to convert an object of class "owin" to a pixel image -- the owin in question is unusual in that it contains multiple, overlapping polygons.

Now I'd like to change (constrict) the frame area of a resulting "im" object by assigning a different and smaller window to it, using pixellate.owin  
## S3 method for class 'owin'
pixellate(x, W = NULL, ...)
where W is Optional - Window determining the pixel raster on which the conversion should occur.

It works perfectly when converting a line segment pattern (pixellate.psp) to pixel image. The resulting "im" is clipped by an assigned, smaller window. But when I try the same with an owin object, it doesn't seem to work I either get an error, when trying it out on a normal (single polygon) owin object: 

Error in pixellate.owin() :  W does not cover the domain of x

But when trying it out on my multi-polygon owin object, the frame area barely changes and I can't control the pixel resolution of the resulting image. See code below.
I'm sure I'm missing something basic about windows and pixellating them. If my question is not up to standards for this List, I'll stop perstering, just wanted to try again.
I'd be grateful any help, thank you!!



## convert line segment object to a pixel image
> A <- pixellate(Depth, dimyx=200)
> summary(A)
real-valued pixel image
200 x 200 pixel array (ny, nx)
... 
Image is defined on the full rectangular grid
Frame area =  3336.49966365421 square kilometer 

## now assign a smaller window to the same line segment object being converted to pixel image
> A2 <- pixellate(Depth, W=convexW3, dimyx=200)
> summary(A2)
real-valued pixel image
200 x 200 pixel array (ny, nx)
... 
Image is defined on a subset of the rectangular grid
Subset area =  747.515033662265 square units 


## All works well
## now when I try same thing to my owin object (which contains multiple polygons), the frame area stays same - if anything increasing just a tiny bit
##pixellate owin object
> A <- pixellate(Mowin, dimyx=200)
> summary(A)
real-valued pixel image
200 x 200 pixel array (ny, nx)
...
Image is defined on the full rectangular grid
Frame area =  1323.61474064852 square kilometer 

## now assign a smaller window to the same owin object being converted to pixel image
> A2 <- pixellate(Mowin, W=W3, dimyx=200)
> summary(A2)
real-valued pixel image
200 x 200 pixel array (ny, nx)
...
Image is defined on the full rectangular grid
Frame area =  1325.20504128399 square kilometer 




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20110531/6e0bf90a/attachment.html>


More information about the R-sig-Geo mailing list