[R-sig-Geo] extracting values from rasters
Camilo Mora
cmora at dal.ca
Sun Oct 7 19:58:18 CEST 2012
Thanks Barry,
I did try resample. Unfortunately, it is taking about 15 minutes and
after that it says that it failed returning the message "Reached total
allocation of 5813Mb: see help(memory.size)".
I converted my habitat raster to points (about 500,000) and use the
"extract" fucntion. it does the extraction in about two minutes, which
makes me realize that the resample function is taking to long because
of the interpolation method.
Do you know if there is an analogous function to resample that
considers just the overlap of cells to assing values?.
Thanks,
Camilo
http://www.soc.hawaii.edu/mora/
Quoting Barry Rowlingson <b.rowlingson at lancaster.ac.uk>:
> On Sun, Oct 7, 2012 at 7:56 AM, Camilo Mora <cmora at dal.ca> wrote:
>> Hi:
>> I wonder if anyone knows a function to extract values from one raster
>> to another raster when the rasters differ in resolution and extent. In
>> other words extracting values just in overlapping cells.
>>
>> This is my specific problem: I have two rasters (one is for
>> temperature worldwide and the other is for the presence of reefs also
>> worldwide (the presence of reefs have values of 1 and all other cells
>> as NA)). (the rasters differ in resolution and extent). I just need to
>> put the values of the raster of temperature to each cell in the raster
>> of reefs. Will you know a function that may do this?
>
> You want to start off looking at the 'resample' function in the
> raster package. Read the note at the start of that about other
> possibilities. Since your cells don't line up, there's various ways of
> deciding what the value for a target cell is, including just sampling
> the centre points, or interpolating overlapping cells in various ways.
>
> Barry
>
>
More information about the R-sig-Geo
mailing list