问题描述
我正在尝试将栅格网格导入Netlogo,但是遇到很多问题。我的栅格文件只有57x41像素(我希望这里的每个像素代表一个补丁),并且世界信封是[-382875 -381135 700185 701445]。我还试图将我的栅格数据集值与.csv文件中的补丁变量fuel-code相匹配。但是,当我运行下面的代码时,我遇到了错误。我没有在netlogo中使用设定的坐标投影,因为我的原始栅格不是Netlogo可接受的投影类型(导入.asc文件时,我删除了与栅格关联的.prj文件)。下面是我的代码(包含我尝试编辑的代码的错误消息):
extensions [ csv table gis]
globals [ fuel-type-40 fuel-code setrial1]
to dictionary-file ;put in the setup procedure
ca
;load the ascii file
set setrial1 gis:load-dataset "setrial_ascii.asc"
;match dimensions of raster to the dimensions of the Netlogo world
;I've tried each of the below codes independently,not together
resize-world 0 gis:width-of setrial1 0 gis:height-of setrial1 ;ERROR: Java Heap space error
gis:set-world-envelope gis:envelope-of setrial1 ;ERROR: can't modify a patch's coordinates
;below is visuals of width and height of setrial1
print gis:height-of setrial1 ;41
print gis:width-of setrial1 ;57
print envelope-of setrial1 ;[-382875 -381135 700185 701445]
; Load the csv
set fuel-type-40 but-first csv:from-file "fuel-type-40.csv"
;print fuel-type-40
; Pull first value (Fuel-code)
set fuel-code map first fuel-type-40
;print fuel-code
ask patches [
; Randomly set patch 'land cover' for this example. change for raster
gis:apply-raster setrial1 fuel-code
]
end
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)