Thursday, November 19, 2015

Using Shapefiles in NetLogo

Carrying on with the theme of linking GIS to NetLogo for creating agent-based models. We would like to showcase two simple models. Both are based on using a shapefile to create Schelling-inspired segregation model.

In the first model (as shown in the movie below) we use the polygons to be individual agents. In this example, we import a shapefile where each polygon is either a red or blue agent; or unoccupied (grey). The agent evaluates its neighborhood (i.e. surrounding polygons) and if dissatisfied with its neighborhood moves to an unoccupied polygon. More information  about the model and simple tutorial can be found here and the code and data can be downloaded from here.



In the second example (as shown in the movie below), we use attributes from the shapefile to add a specific number of agents to each polygon and again, the agents move if they are dissatisfied  with their current location. This is calculated by the agents examining both their geometrical neighboring polygons; and their 8-connected neighbors. The underlying color of the polygon is based on the which agent group is in the majority (i.e. a red polygon has more red agents than blue agents).

In addition to showing how to work with shapefiles within NetLogo we have also added some statics which you might find useful. The ability to calculate  Moran's I and a segregation index. Further  information  about the model can be found here and the code and data can be downloaded from here.



If you are interested in learning more about GIS and agent-based modeling in NetLogo it is worth checking out Yang Zhou's website Geospatial Computational Social Science.


4 comments:

Anonymous said...

Nice read!

As I use GAMA quite often (because of the beautiful integration of raster data) I am highly interested whether GeoTiff support is implemented in NetLogo.

All the best,

Andrew Crooks said...

Hi, Thanks for taking an interest in the work. For GeoTiff have a look at our Rainfall Model: NetLogo post. The GIS support in Netlogo is good and we are still exploring all the possibilities. Its very different from say MASON and Repast with several work arounds needed. We will have more on this in the next few months. I have only seen bits of GAMA if you know of some good resources / demos etc please let us know. We are always on the lookout for new ways of making models.

Benjamin Mewes said...

Thanks for your answer - I will take a closer look soon :)

If you're interested I could write a short tutorial for GAMA (but you will also find lots of tutorials in the basis installation). I work with the tool for three months now and the learning curve is fine.

Andrew Crooks said...

Thanks, I will take a look. Others here have said good things about GAMA also.