Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get agents to interact with the attributes of a shapefile in NetLogo

Tags:

gis

netlogo

In my NetLogo model I've loaded in a shape file

set map gis:load-dataset "land_use.shp"
  gis:set-world-envelope gis:envelope-of map

and I can colour the attributes of this shape file according to whether they're on water or on land as follows:

foreach gis:feature-list-of map
[if gis:property-value ? "CODE_12" = "523" [ gis:set-drawing-color blue gis:fill ? 2.0]
if gis:property-value ? "CODE_12" = "522" [ gis:set-drawing-color green  gis:fill ? 2.0]
if gis:property-value ? "CODE_12" = "521" [ gis:set-drawing-color green  gis:fill ? 2.0] ]

With that done, how can I have my agents interact with the patches based on their colour?

For instance, in a standard model without GIS data I could have something like:

if [pcolor] of patch-here = blue [set size 2] 

Thanks

like image 608
adkane Avatar asked Dec 21 '25 23:12

adkane


1 Answers

I found a solution to my question:

to check
let estuaries gis:find-features map "CODE_12" "522"
if gis:intersects? estuaries self [
set color red
]
end
like image 84
adkane Avatar answered Dec 23 '25 13:12

adkane