I have data on a number of ecological variables associated with spatial points. Each point has x & y coordinates relative to the bounding box, however the points represent circular areas of varying diameter. What I'm trying to achieve is to project the area occupied by each point onto the observation window so that we can subsequently pixellate the area and retrieve the extent of overlap of the area of each point with each pixel (grid cell). In the past I have been able to achieve this with transect data by converting to a psp line object and then using the pixellate function in the spatstat package but am unsure how to proceed with these circular areas. It feels like I should be using polygon classes but again I am unsure how to define them. Any suggestion would be greatly appreciated.
Asked
Active
Viewed 358 times
0
-
This seems like a more general problem, not specific to R. You could build grid and for each point in the grid calculate if the point is within any circle (less than radial distance form the points). Alternatively you could try simulation over the grid also. – Rohit Das Nov 01 '13 at 17:07
-
1I'd suggest using the spatial data types implemented by the **sp** and **raster** packages. Then, you could use (something like) `rgeos::gBuffer()` to create circular `SpatialPolygons` of the desired radii surrounding each point (ideally stored as a `SpatialPolygonsDataFrame` with attached attribute data), `raster::rasterize()` to convert the SPDF to a raster registered on your existing raster, and `raster::crosstab()` or `raster::zonal()` to extract info about the areas of overlap. (Had you included a minimal reproducible example, I might have showed you how to do this ;) – Josh O'Brien Nov 01 '13 at 17:12
-
Thanks, R is what I generally use so I'm ideally looking for an r solution. I have thought of a few ways to do this more 'manually' but I was hoping to avoid this by harnessing the spatial functionality of many r packages. Just can't figure out the first step. – Anna Krystalli Nov 01 '13 at 17:17
-
Josh is offering to show you ... you just need to provide code that will construct or link to sufficient data objects that create the substrate for a solution. People here don't think it's their responsibility to build an entire tutorial just for you. You have data, we have experience. – IRTFM Nov 02 '13 at 01:00
1 Answers
0
In the spatstat
package, the function discs
will take locations (x,y) and radii r (or diameters, areas etc) and generate either polygonal or pixel-mask representations of the circles, and return them either as separate objects or as a single combined object.

Adrian Baddeley
- 1,956
- 1
- 8
- 7