TWest
TWest

Reputation: 824

Netlogo: Shapefile versus Raster

I am currently working with a model in NetLogo that simulates land-use change in some farms. For that I need to use the GIS extension in NetLogo. I am far from having a model running but I was wondering if the best way to go with my model would be:

(1) Using a shapefile with the farms' boundaries and overlay it with other raster maps (such as euclidean distance from markets)

or

(2) Using a raster with cell IDs representing the farms. In that way, I can have a perfect overlap between properties and the other raster maps.

Thank you in advance!

Upvotes: 2

Views: 1160

Answers (2)

TWest
TWest

Reputation: 824

By the end of the day this was the best way to go with the problem:

extensions [gis] 
globals 
[ 
  land-use-map 
  lotid-patch-map 
  def-risk-map 
  market-dist-map 
] 

patches-own
[ 
  land-use 
  lotid-patch 
  def-risk 
  market-dist
]

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; load the maps   ;;
;;;;;;;;;;;;;;;;;;;;; 

to load-gis

  clear-all

  set land-use-map gis:load-dataset "area2_lu_black.asc"     ;loads the land use map
  set lotid-patch-map gis:load-dataset "area2_lot.asc"       ;loads the lots map 
  set def-risk-map gis:load-dataset "area2_risk.asc"         ;loads the deforestation risk map 
  set market-dist-map gis:load-dataset "area2_mkt.asc"       ;loads the distance from markets map 

  gis:set-world-envelope-ds gis:envelope-of land-use-map     ;sets the envelope of the world to match that of the GIS dataset

  gis:apply-raster land-use-map land-use                     ;patches in the land-use-map have a specific land-use now
  gis:apply-raster lotid-patch-map lotid-patch               ;patches in the lot-id-map have a specific lot-id now
  gis:apply-raster def-risk-map def-risk                     ;patches in the def-risk-map have a specific def-risk now   
  gis:apply-raster market-dist-map market-dist               ;patches in the market-dist-map have a specific market-dist now 

  ask patches [

    if land-use = 1 [ set pcolor 64 ] ; Green = Forest
    if land-use = 2 [ set pcolor 14 ] ; Dark red = Agriculture
    if land-use = 3 [ set pcolor 45 ] ; Yellow = Reforestation 

  ]

  let view gis:load-dataset "area2.shp"                      ;load a shapefile of the properties
  gis:set-world-envelope-ds gis:envelope-of view
  foreach gis:feature-list-of view
  [
    gis:set-drawing-color white                              ;draws the line of the shapefile
    gis:draw ? 1
  ] 

end

Upvotes: 1

JenB
JenB

Reputation: 17678

I suspect that the answer depends on how you are intending to use the information contained in your GIS files. All I can really suggest is that you collect a few ways that people have integrated GIS and see what looks most similar. Here's a first example for you.

I had a recent model that had a strong spatial component for spreading an epidemic. Epidemic infectivity is strongly influenced by population. I obtained population density at the subregional level for all the countries I had in the model (drop down box to select the country) as a raster file. Importing that into NetLogo as patch information effectively resizes the raster. I then had a conversion for NetLogo patch to real-world square kilometers (for each country) to create population for each NetLogo patch.

Upvotes: 2

Related Questions