[R-sig-Geo] Need an algorithm to identify spatial clusters

van Etten, Jacob (IRRI) J.vanEtten at cgiar.org
Wed Apr 15 01:53:39 CEST 2009


Mark,

The package igraph has a quick connected component algorithm,
implemented in C. 

You would first need to create a graph from your grid, connecting
adjacent cells. Raster (downloadable from R-Forge) has the function
'adjacency' that might be helpful in doing that (plus other
functionality that might be helpful with grids in general).

Good luck.

Jacob van Etten

-----Original Message-----
From: r-sig-geo-bounces at stat.math.ethz.ch
[mailto:r-sig-geo-bounces at stat.math.ethz.ch] On Behalf Of Mark Andersen
Sent: Wednesday, April 15, 2009 12:27 AM
To: r-sig-ecology at r-project.org; r-sig-geo at stat.math.ethz.ch
Subject: [R-sig-Geo] Need an algorithm to identify spatial clusters

Hello, all,

I am currently interested in simulating the initiation and spread of 
forest fires in simulated landscapes consisting of 2 tree species (a 
native and an invasive). I'm simulating fire seasons of fixed length; 
fires can start at any time and in either tree species during this fire 
season, and spread through the simulated forest according to a simple 
percolation-like process. I have developed the algorithms for this in 
Matlab, and don't anticipate any problems converting them to R if I need

to.

However, it's the next task that has me at a loss. At the end of each 
fire season, there will be several burned patches on the simulated 
landscape; the number of these patches won't necessarily correspond to 
the total number of fires that season, because fires may coalesce. I 
need to count how many of these burned patches there are, and find the 
size of each. It seems that there should be an algorithm available to do

this, but I haven't found one, possibly because I haven't been using the

right search criteria. I used RSiteSearch("spatial cluster"), and got 
many references to the spatclus package. However, from the spatclus 
documentation it appears that this is not quite what I'm looking for. 
Spatclus looks like it picks out potential clusters of occurrence of 
some phenomenon (such as earthqukes or cancer); I need something that 
will delineate clusters of contiguous pixels with the same value (i.e., 
burned in my simulations). Could anyone point me towards such an 
algorithm, or help me get started finding one?

-- 
Dr. Mark C. Andersen, Professor
Department of Fish, Wildlife, and Conservation Ecology
New Mexico State University
Las Cruces, NM 88003
575-646-8034
fax: 575-646-1281
web: web.nmsu.edu/~manderse

_______________________________________________
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