Skip to content
Back to formatted view

Raw Message

Message-ID: <233545.41035.qm@web58006.mail.re3.yahoo.com>
Date: 2010-12-30T14:43:30Z
From: Michael ODonnell
Subject: How to Convert extract() results to 2D matrix

I am using the extract() function within the R raster package and I am trying to 
both understand the output as well as figure out how to convert the output to a 
2D matrix. So, I am using a SpatialPoints file and the method "buffer". The 
returned results represent rows, point location, and columns, pixel values 
extracted. Ultimately, I want to convert each record to a 2D matrix.

Questions:
How do I convert the extract() results, using the buffer method, to a 2D matrix 
for each point?

Does the buffer method return pixels that fall within a radius (circle), and is 
the buffer defining a 2D array? If extract returns pixels within a circle, does 
it assign NA to the pixels in the circle that fall outside the circle but reside 
within a 2D matrix (This is generally how most programs I work with handle 
this).

What happens when a point falls near the edge of a raster dataset and the buffer 
distance exceeds the distance between the point and the edge of the raster--Are 
NAs returned or do these result in a non-square 2D array?

Thank you for your help,
Mike