[R-sig-Geo] patch geometry

pgalpern pgalpern at gmail.com
Tue Jan 31 19:34:38 CET 2012


There is a very alpha package called landscape that provides a front-end
to the FRAGSTATS code in R (http://landscape.r-forge.r-project.org/).

If you are looking for a simpler approach, consider the raster package.
I have found that functions clump() and zonal() together can do a lot of
this work.

For example:

library(raster)
## Create dummy raster for illustration
r<- raster(nrow=50, ncol=50)

## Fill randomly with integers from 0 to 9
r[]<- trunc(runif(2500)*10)

## Find patches (defined as contiguous cells of class 1)
patch<- clump(r==1)
plot(patch)

## Find the number of raster cells in each patch
## Useful if cells are of equal area
patchCells<- zonal(r, patch, "sum")

## Find the area of raster cells in each patch
patchArea<- zonal(area(r), patch, "sum")

-- 
Paul Galpern, PhD Candidate
Natural Resources Institute
70 Dysart Road
University of Manitoba
Winnipeg, Manitoba, Canada R3T 2M6
http://borealscape.ca



On 31/01/2012 10:35 AM, Ana wrote:
>  Hi!
>
>  I am looking for a package that can give me a patch geometry (mean
>  size, standard deviation, ...) from a land use/cover dataset in raster
>  format, in R.
>  Similar to what FRAGTSAT does.
>
>  I've found a while ago a post in this forum concerning this same
>  request, however I am not able to find it again or to remember the
>  name of the package recommended.
>
>  Can someone help me out?
>
>  Many thanks !!
>
>  _______________________________________________
>  R-sig-Geo mailing list
>  R-sig-Geo at r-project.org
>  https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list