16  Importing spatial data: elevation and site data

To build the Messara Trade model, we will take several advanced steps. Through a sequence of module development, we will reach a final version that extends the Pond Trade model to a ‘grounded’ production process and contextual data that refers specifically to our case study.

We advance with a minor revision to our previous conceptual model:

Pond Trade conceptual model at step 14 (second tier)
Pond Trade conceptual model at step 14 (second tier)

16.1 The gisextension

The NetLogo default installation includes an extension to support GIS that can be used by adding the following to the first section of your script:

This extension allows you to perform a variety of GIS operations and to connect patch and turtle behaviour to data expressed in GIS files, supporting both vector and raster. The description of its contents can be found here: https://ccl.northwestern.edu/netlogo/docs/gis.html

We will only reference a few aspects of GIS in NetLogo. You will find useful examples in NetLogo’s Models Library (e.g., Sample Models > Code Examples > Extensions Examples > gis > GIS General Examples).

16.2 Loading GIS data

We start by loading all GIS data into separate NetLogo variables. To know about the formats this extension accepts, see here: https://ccl.northwestern.edu/netlogo/docs/gis.html#gis:load-dataset.

The files in “data/Cretedata/” were distributed during our in-person session, courtesy of Dr Eleftheria Paliou (University of Cologne). Site coordinates were randomly shifted in QGIS to be published online after the session.

We are using:

  • Two shape files containing point coordinates of various archaeological sites in the region, corresponding to two aggregated periods (see Minoan Chronology):
    • EMIII_MMIAsites.shp: sites dating from the Prepalatial Period, specifically the Early Minoan III (EMIII) and Middle Minoan IA (MMIA) Periods
    • MMIBsites.shp: sites dating from the Protopalatial Period, specifically the Middle Minoan IB (MMIB) Period
  • A DEM raster file: dem15.asc (elevation of the terrain with a 15m resolution)
  • A third shape file, rivers.shp, contains line data with the rivers within the region.

16.3 Readjusting world settings

The second step is ensuring that our world and world view in NetLogo fits the data we want to feed into them. In this case, we need to reduce the DEM resolution to handle all patch processes in a reasonable computation time.

16.4 Applying GIS data to patches

Next, we effectively apply the data to patches using the gis extension primitives:

Notice that the gis extension generates NaN values on those patches outside the raster data. NetLogo does not handle NaNs, which can become a problem later. To solve this, we create a patch-set variable to filter patches with elevation data (patchesWithElevationData) and use a constant noElevationDataTag with an impossible elevation value to mark those outside the heightmap. From now on, we need to be careful not to use the patches primitive, which will call both kinds of patches.

16.5 Higher level procedure: create-map

We wrap up everything in a procedure create-map:

16.6 Visualisation

Finally, we need to add some extra code in order to display our data:

16.7 Set up procedure and testing

We then we place both in a higher-level procedure, using the conventional setup (and adding its button):

Screenshot of the ‘load-gis-data’ module
Screenshot of the ‘load-gis-data’ module

See the fully implemented version of this module: BlockC_module1_load-gis-data.nlogo.