How can I tell my agents not to move outside of gis:load-dataset

33 Views Asked by At

I am working with a raster data set (image) which corresponds to my patches, the problem is that my patches are displayed as a map, each one has a variable called coverage that corresponds to specific values and colors, but the agents are left off the map because they consider that the background of it is also part of the patches.

I haven't found a way to restrict them to the area and not move outside of it.

to setup-mapa 

  set mapa-coberturas gis:load-dataset "C:\\RASCII.asc" 
  gis:set-world-envelope gis:envelope-of mapa-coberturas

 ask patches [ 
    set coberturas gis:raster-sample mapa-coberturas self 

    if coberturas >= 0 and coberturas < 1 [ set pcolor  8 ] 
    if coberturas >= 1 and coberturas < 2 [ set pcolor 68 ] 
    if coberturas >= 2 and coberturas < 3 [ set pcolor 49] 
    if coberturas >= 3 and coberturas < 4 [ set pcolor 28] 
    if coberturas >= 4 [set pcolor 79] 
    if coberturas < 0 [ set pcolor 130 ]
    ] 
 
ask patches with [coberturas <= 0] [if any? neighbors with [pcolor = black][set borde-negro 1]]

A help or explanation on how to ask the agents not to move through the black patches or get close to the edge

0

There are 0 best solutions below