[R-sig-Geo] how to find cells in a raster
Robert J. Hijmans
r.hijmans at gmail.com
Wed Jun 23 19:12:08 CEST 2010
Roman,
Perhaps you can make a RasterLayer with the cell numbers and then use
xyValues with a buffer
r <- raster(original.raser)
r[] <- 1:ncell(r)
xyValues(r, points, buffer=?)
Robert
On Wed, Jun 23, 2010 at 7:02 AM, Roman Luštrik <roman.lustrik at gmail.com> wrote:
> Dear list,
>
> I'm trying to find cells in a RasterLayer object. Specifically, I'm trying
> to find all cells within a radius from a pre-defined point. When I have cell
> numbers or coordinates, I can calculate their distance from the
> aforementioned pre-defined point.
> So far, I've been overlaying a polygon and extracting cell numbers with
> polygonValues(), however, this method seems to be somewhat slow (especially
> on larger rasters). I've benchmarked it and it is approximately as fast as
> if I used distanceFromPoints(), which calculates distances for all cells in
> a raster. Is there a faster way of finding these cells?
>
> Cheers,
> Roman
>
>
> --
> In God we trust, all others bring data.
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
More information about the R-sig-Geo
mailing list