Thank you Robert, helpful as always. distance function did the trick.

Maybe I should shortly describe my approach to preserve it for posterity.
I have a polygon on a raster (with non-polygon cells set to NA). Using
function raster::distance, I was able to calculate distance for all NA
cells. I set cells with values higher than my desired "buffer range" to NA.
I then used this raster as a mask to clip my initial object (this object has
values 1:ncell(my.object)).


Cheers,
Roman



On Thu, Nov 18, 2010 at 3:29 PM, Robert J. Hijmans <r.hijm...@gmail.com>wrote:

> Roman, Have you tried combinations of the functions 'edge', and
> 'distance' (and perhaps adjacency, if the 'amount' is expressed in
> cells rather than distance). Robert
>
> On Thu, Nov 18, 2010 at 5:58 AM, Roman Luštrik <roman.lust...@gmail.com>
> wrote:
> > Dear list,
> >
> > I've been searching around and I continue to do so, but in the mean time
> I'm
> > seeking your advice on how to improve my approach.
> >
> > I'm using raster package and I'm trying to find cells around (let's call
> it
> > a buffer) and inside a polygon. These subsetted cells are used for
> > calculations later on. I'm basically trying to "grow" a polygon by a
> certain
> > specified amount.
> >
> > I have created a raster with values derived as 1:ncell(my.object), where
> > each value actually represents cell number and in a sense, position. This
> is
> > the playground for my polygon.
> >
> > So far, I've approached this by:
> > - find cell values inside the polygon (former raster::polygonValues)
> > - find cell values within the buffer of SpatialLines object (made from
> the
> > above polygon) (former raster::lineValues)
> > - find unique cell values from the above results
> >
> > The problem is that finding buffers around each cell on a line (second
> step)
> > is pretty RAM greedy. Would there be a more efficient way of "growing" a
> > polygon, preferably without using external software?
> >
> >
> > Cheers,
> > Roman
> >
> >
> >
> > --
> > In God we trust, all others bring data.
> >
> >        [[alternative HTML version deleted]]
> >
> > _______________________________________________
> > R-sig-Geo mailing list
> > R-sig-Geo@stat.math.ethz.ch
> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> >
>



-- 
In God we trust, all others bring data.

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to