Neighbourhood Dynamics

Let w be a moving window filter of dimensions 5×5 cells (500 x 500 metres here).

w <- matrix(c(0,0,50,0,0,0,50,50,50,0,50,50,500,50,50,0,50,50,50,0,0,0,50,0,0), nr=5,nc=5)

w
     [,1] [,2] [,3] [,4] [,5]
[1,]    0    0   50    0    0
[2,]    0   50   50   50    0
[3,]   50   50  500   50   50
[4,]    0   50   50   50    0
[5,]    0    0   50    0    0

n <- focal(lu56, w=w)
plot(n)

This command generates a neighbourhood transition potential map from lu56. Have a look at this useful webpage:

http://scrogster.wordpress.com/2012/10/05/applying-a-circular-moving-window-filter-to-raster-data-in-r/

But it has the unwanted side effect of increasing the width of the nodata areas, thus massively increasing the size of the feature land use classes and the zoned area. We seriously don’t want this. BUT, luckily, its easily fixed:

nhood <- cover(n, lu56)

The cover operation (see Raster package manual) fills the null values in the first map with the values in the second, so now we have a final neighbourhood potential map for the transition period 1956-57

plot(nhood)
zoom(nhood)

model_nhood <- nhood   #rename to model_nhood so we know this is our final neighboorhood potential map.

sanlucar_nhood

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s