Nell
Nell

Reputation: 559

Importing rasters into Netlogo

I am trying to use the GIS Extension to import a raster map into NetLogo. Here is my code:

set map gis:load-dataset "C:/data/testraster5mglobal.asc"
gis:set-world-envelope-ds gis:envelope-of map
gis:apply-raster map hab
ask patches with [ hab = 2] [set pcolor white]

In comparison with my raster (figure 1), the corridors represented in white do not appear entirely in NetLogo (figure 2). How can I resolve this problem ?

Figure 1

enter image description here

Figure 2

enter image description here

Here is the header of my asc file:

ncols         8298
nrows         8891
xllcorner     616738.95851945
yllcorner     4992014.9456261
cellsize      5
NODATA_value  -9999

Thanks in advance for your help.

Upvotes: 2

Views: 1851

Answers (1)

Eric Russell
Eric Russell

Reputation: 198

It looks like apply-raster is doing a poor job of resampling your raster, possibly because the resolution of your raster is much higher than the resolution of the patches in NetLogo. Setting the size of the NetLogo world to match your raster probably isn't going to work, because it's so large. Have you tried down-sampling your raster outside of NetLogo, possibly using GDAL? Another thing you might try is changing the resampling method used by apply-raster (see http://ccl.northwestern.edu/netlogo/docs/gis.html#gis:set-sampling-method)

Upvotes: 1

Related Questions