The first is that lists are not mutable - if you want to change the value in a list, you have to create a new list with that value. Remember to fully document the script.Several problems. I prefer that you make the code execute from the "C:\Temp" folder to make grading easier. Turn in a NetLogo script with the associated data in the same folder. Here are some examples of me working with the GIS Extension: One example would be to use the raster data to represent the type and/or amount of forage and have your turtles interact with it as the sheep did in the Wolf-Sheep model. Then, I recommend creating some turtles and moving them about based on the raster data beneath them. It may be best to start with one of the examples and just replace some of the GIS data with your own. Do not try to put too many behaviors together in one model. You'll also want to select a relatively simple model such as predator-prey, migration, or moving between roosting and feeding locations. Otherwise, you'll spend too much time working on performance to complete the model in the time allotted. Designing The Modelįor this task, you'll want to select an area that you have data for and than can be represented in a relatively small number of pixels (i.e. Take a look at each of these examples and I recommend saving your own copy of them with comments. This is a rather interesting example but I think creating rasters can be better done in a GIS application. The "GIS Gradient Example" shows how to access the values within rasters, create new rasters, and move turtles based on raster values. The "GIS General Examples" shows how to load and render various types of GIS data into the NetLogo interface. In NetLogo, to to "Models Library -> Code Examples -> GIS". There are only a couple of examples available for the GIS extension. You can detect these in NetLogo with: if ((gx = 0)) and ((gy = 0)) if this is true, the values gx and gy are valid The GIS Examples This occurs with values generated on computers, for instance when zero is divided by zero (0/0). Note that here we are using "let" to create the variables instead of "set" for variables that are already defined. You can also get values based on a turtles position as in the code below: let h gis:raster-sample raster self "raster" is the name of the variable containing the raster and "gx" is the variable to be set to the pixel value. I have not explored accessing vector data within NetLogo but the code below will access the raster values where "x y" is the horizontal and vertical location of the desired pixel. Note that the loading of shapefiles and raster files is similar but the command "draw" is used to render vector data (shapefiles) and "paint" is used to render rasters into the view. Gis:set-world-envelope gis:envelope-of elevation Set elevation gis:load-dataset "data/local-elevation.asc" The code below will load three raster files and then display each one based on a different button press. ![]() ![]() Set countries-dataset gis:load-dataset "C:/ProjectsModeling/NetLogo/cntyoutl/CNTYOUTL.SHP" The code below load a shapefile on setup and then display it when the "display-countries" button is pressed. The GIS extension for NetLogo allows you to load and display GIS information in ASCII Grid files and shapefiles. In this lab you will use the GIS extensions to NetLogo to create a spatially-explicit model in an existing landscape. ![]() Lab: Spatially-Explicit Agent Based Model Using NetLogo GIS Extensions
0 Comments
Leave a Reply. |