A common analysis tool for spatial data is "patch statistics". The idea behind this is to divide a map up into connected clusters of the same type - called patches - and then compute statistics for these. This is quite similar to the blob detection used in [http://www.mo-seph.com/projects/interactable vision based multitouch] projects. The flagship program for doing this is [http://www.umass.edu/landeco/research/fragstats/fragstats.html Fragstats] which is great, but it is windows only, and it can be a bit fussy about input formats [#Raster files have to have headers stripped off, and the information re-entered on the command line, problems with rasters that are not explicity integers (i.e. 0.0), line ending issues]. So, for a cross platform approach, R seems to be quite appealing.
The package which seems to do this most directly is [http://cran.r-project.org/web/packages/SDMTools/ SDM Tools]. The process is reasonably simple:
Start with a land use raster, and extract the built up areas (see previous post: [intentiospatial/RastersInR]):
r <- raster( "../firstRun/koper-COM-1265971193-landUse-2030-30.asc" ) b <- getBuiltAreas( raster=r ) par(mfrow=c(1,2)) plot( r ) plot( b )
Now extract connected clusters; SDMTools provides a function called "ConnCompLabel" which does this:
c <- ConnCompLabel( b ) plot( c )
Now we can make the patch statistics:
[geshifilter-code] > ps <- PatchStat( c ) > ps[order(-psTeX Embedding failed!n.cell)[1:10]"), and some interesting statistics about them (selected using c(1,2 ... ) ).