[R-sig-Geo] Clearing the area outside of a polygon defined on a grid.

peleve pitiur at gmail.com
Thu Nov 15 15:19:03 CET 2012


Thank you very much.  That worked, mostly!?!  But I see the methodology now.
I had been thinking about masks, but I was asking the wrong question I now
realize.
In my real application, using your approach, I still have some unwanted bits
left outside of the polygon.  I traced it as a left over piece from
contouring the data... contours are vector objects. Your suggestion works
for the raster object,  and worked for the Akima result (outside the polygon
and inside the convex polygon that Akima works in).
I now realize that what I need is a hole in a polygon, outside colored
white, inside transparent, or a polygon with everything outside white and
inside transparent. The hole is the outline of the area with the contours
within the bounding box.
Any thoughts on how to do that?
Thank you again.


I think you can do:

x <- raster(akima)
y <- mask( x, SpP[2] )
plot(y)






--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Clearing-the-area-outside-of-a-polygon-defined-on-a-grid-tp7581718p7581721.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list