[R-sig-Geo] Counting number of points per pixel in a grid

Anna Marburg MarburgA at landcareresearch.co.nz
Wed Oct 21 23:32:40 CEST 2009


Hello Heather -

The first thing to do is explore your data and make sure that your
grid and points have imported correctly.

Different spatial packages have slightly different classes, so its
always a good idea to use class() to make sure that your object is
what you think it is. plot(), summary() and str() are also often
helpful.


If you are still unable to get overlay to work, try the "quadratcount"
function in the spatstat package (you will need to define your points
as a spatial point pattern first).

You can specify either the number of pixels you want to divide your
study area into, provide 2 vectors of break-points, or format your
grid as a "tesselation".

The drawback is that with thousands of pixels, it may be quite slow.
Try it on a subset of the data first, to see if it does what you want.

Others will probably have more efficient suggestions.

HTH,

Anna

~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Dr. Anna E. Marburg
Postdoctoral researcher
Ecosystem Processes Team
Landcare Research
P O Box 40
Lincoln 7640
NEW ZEALAND

phone + 64  3 321 9729
MarbugA at landcareresearch.co.nz

~~~~~~~~~~~~~~~~~~~~~~~~~~~~




Please consider the environment before printing this email
Warning:  This electronic message together with any attachments is confidential. If you receive it in error: (i) you must not read, use, disclose, copy or retain it; (ii) please contact the sender immediately by reply email and then delete the emails.
The views expressed in this email may not be those of Landcare Research New Zealand Limited. http://www.landcareresearch.co.nz



More information about the R-sig-Geo mailing list