Friday, September 25, 2015

Reimplementation of the Urban Growth Model in Netlogo

Recently, I have partially re-implemented the Urban Growth Model (UGM) that was developed by Clarke, Hoppen and Gaydos using Netlogo. The study area is the City of Santa Fe in New Mexico, USA.

Here is a picture showing the simulation results after 10 periods:


A video recording a simulation process of the model can be found here:



The code and data could be found here:
<https://github.com/YangZhouCSS/Urban_Growth_Model>


The image below shows the road types and landuse types in the area studied.


In this post, I will briefly talk about how I re-implemented the UGM using Netlogo. The purpose of this model and this post is to assist people who are interested in urban growth and urbanization as well as those interested in learning Netlogo.

The urban growth dynamic implemented in the Urban Growth Model (UGM) contains four types of growth, namely:
(i) Spontaneous Growth - defines the occurrence of random urbanization of land.
(ii) New Spreading Centers - determines whether any of the new, spontaneously urbanized cells will become new urban spreading centers.
(iii) Edge Growth - defines the part of the growth that stems from existing spreading centers.
(iv) Road-Influenced Growth - agents take a road trip along a transportation infrastructure and look for suitable space for urbanization.
Note: Self Modification is not included in this model.

More information regarding the growth process can be found on the project website:

The original paper of the theory of the UGM:

The codes to implement the four types of growth are relatively easy. I would like to talk about the codes that solve the following problems:

1.       How to load GIS data (usually a map) into Netlogo?

The GIS extension of Netlogo allows users to load .asc data into Netlogo. A map can be converted into .asc files in ArcGIS using the tool called “Raster to ASCII”. This process will convert a map into a grid file which contains the size and location information of the whole grid as well as information of each cell.

Here is an example about how to import .asc file into Netlogo:

set urban-dataset gis:load-dataset "data/urban_santafe.asc"

Here I created a global variable called urban-dataset and load the data file into the global variable using “gis:load-dataset”.

Then I have this line:
gis:set-world-envelope gis:envelope-of urban-dataset

“gis:set-world-envelope gis:envelope-of” is a shorthand for setting the transformation by mapping the envelope of the NetLogo world to the given envelope in GIS space, while keeping the scales along the x and y axis the same.

To copy values from the given raster dataset to the given patch variable in Netlogo, I use this line:
gis:apply-raster urban-dataset urban

Note that the grid size in Netlogo is exactly the same as the original data, meaning that they have same numbers of rows and columns.

2.       How to export the results as .asc files so that we can edit it in ArcGIS?

The following codes are used to export the .asc file.



The first few lines with “file-print” are asking Netlogo to write the beginning of the .asc file. This part should be identical to the original data, since we did not modify the size of the grid.

The while loop asks patches in row i to write their urban variable into result.asc file. As i decreases from 393 to 0, we are going through the rows from the first row on top to the one at the bottom.

I wish you are enjoying this post!

Reference: