APoLUS – ESSENTIAL update v 9.3

APoLUS – version 9.3 released

Made some small but important modifications to the allocation script (see the readme file in the new download package for details).

This corrects a problem with the code that incorrectly excluded some active land use classes from the allocation script. This was a serious coding error so please update to the latest version as soon as possible.
If you downloaded before today (26th July 2016), please download again now, I’ve updated the zip file. 

To download the latest version, go here

APoLUS – version 9.2 released

Made some modifications to the allocation script (see the readme file in the new download package for details).

Main modifications include:

  • modified accessibility block to allow import of final accessibility maps
  • modified neighbourhood block to allow import of neighbourhood matrices
  • modified allocation script to allow each block (D,N,A,S,Z) to run separately

If you downloaded before today (6th June 2016), please download again now, I’ve updated the zip file.

To get the full prototype and user manual, go to here

APoLUS Multiple land use simulator now available!

Finally, after a long wait, a prototype version of SIMLANDER that works with multiple land uses  is now available (see screenshot below)

switchboardTo distinguish it from the earlier version that works only for 3 land uses, and to emphasise the addition of the actor characteristics module, the model has been renamed APoLUS (Actor, Policy and Land Use Simulator).

To get the full prototype and user manual, go here

The model code was written by Richard Hewitt for the EU FP7 project COMPLEX, except for the land use allocator, which was written by Maarten van de Meulen, in his free time.

If you are having trouble with the model or if you have any (constructive) comments, please email them to:


SIMLANDER v.1.0.3 and 1.0.4 – Model updated September 2014

SIMLANDER R script versions 1.0.3 and 1.04

In Version 1.03, the selection of highest values from the transition potential map has been rewritten. Instead of extracting values through a GetValues command and then sorting, which I found difficult to code properly, the data are converted to a matrix, output to a dataframe (primarily to facilitate checking but also to make it easy to write out an excel file if desired) and then passed back to matrix again (almost certainly could be done in fewer lines of code, but it does work). A new raster is then generated with the highest values as “1” (urban land). This is the replacement code:

#Select the highest 164 values from the TTP map
#r1demand <- 164  #this is the number of cells we want to allocate from r1
x <- as.matrix(TTP)
n <- urbdemand1  #the demand, calculated by a countdown procedure, above
x2 <-  sort(-x, partial = n)
x2h <-  -sort(x2[1:n])
ix <- which(x %in% x2h)
ro <- ix %% 1151
ro <- ifelse(ro == 0L, 1151, ro)
co <- 1 + ix %/% 1151
x3 <- x[ix]
d <- data.frame(row = ro, col = co, x = x3)
result <- d[rev(order(d$x)), ]
#turn selected 164 values in the dataframe into a matrix and then to a raster
x.mat <- matrix(0, 1151, 749) #create a matrix with the right number of rows and columns and fill with 0 values
#x.mat[cbind(result$row,result$col)] <-result$x   #works just fine.
x.mat[cbind(result$row,result$col)] <-1   #but actually we want values to be 1 (urban land), not the TP value.
#which(!is.na(x.mat), arr.ind =TRUE)  #pick out the non-NA values. Useful for testing that this has actually worked.
r <- raster(x.mat)
e <- extent(c(150938,225838,4070192,4185292))
extent(r) <- e

As in previous versions, new land to be allocated is calculated by: (urban cells in final map-urban cells in initial map/number of years). The new land to be allocated at each time step is then added to the existing urban land from the previous step. If this is not what you want, look at version 1.0.4.

SIMLANDER R script version 1.0.4

In Version 1.04, which includes all the updates made in version 1.0.3,  the principal change relates to the way the land is allocated at each time step.

Instead of adding the new land (calculated by urban cells in final map-urban cells in initial map/number of years) to be allocated at each time step (e.g as in version 1.03) now the model allocates all of the urban land cells in the map at each time step, according to the results of the transition potential calculation. The total urban land in each time step is calculated by taking the cell count for urban from the initial map and then increasing the cells allocated at each time step until the final desired demand is reached.

This means that each time step is effectively a blank sheet, and that urban land can, if necessary disappear between time steps. Though there may be few cases in which this is desirable, this is much closer to the way that original CA models (like the game of life) work.


A note on calibrating the Neighbourhood Effect (N)

The strength of the Neighbourhood effect (N) depends on the values given to the weights in the matrix that is applied to the land use map with the focal command (see Neighbourhood Dynamics). Clearly, if the weight values applied to N are many times higher than the values that are computed in the Accessibility (A) and Suitability (S) maps, then N will be much stronger that A or S. But in some situations this might not be realistic. For example, if we replace
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 <- matrix(c(0,0,0.5,0,0,0,0.5,0.5,0.5,0,0.5,0.5,5,0.5,0.5,0,0.5,0.5,0.5,0,0,0,0.5,0,0), nr=5,nc=5)

The other parameters (e.g. accessibility, suitability and randomness) play a much larger part in determining the areas that are most likely to change. In this case, it makes for a much more realistic simulation. Compare:

strongN weakN

At left, neighbourhood rules as normal. At right, neighbourhood rules adjusted downwards by a factor of 100.

SIMLANDER v.1.0.2 – Model updated and Improved february 2014

I’ve prepared an updated version of the model which runs much faster than before (about 10 minutes to complete, instead of 20). Thanks very much to Dr Graeme Hill for the improvements to the code.

The coding for the stochastic parameter also made very little sense. I’ve updated that too. The new code is posted on the script page and updated elsewhere too. The next task is to get the model running for multiple land uses. We’ll see how we get on!