我目前正在使用NetLogo中的模型来模拟某些农场的土地使用变化。为此,我需要在NetLogo中使用GIS扩展。我远没有模型运行,但我想知道是否最好的方式去与我的模型将是:Netlogo:Shapefile与光栅
(1)使用shapefile与农场的边界和覆盖与其他栅格地图(如欧几里得从市场距离)
或
(2)采用与代表农场小区ID的栅格。这样,我可以在属性和其他栅格地图之间有一个完美的重叠。
预先感谢您!
我目前正在使用NetLogo中的模型来模拟某些农场的土地使用变化。为此,我需要在NetLogo中使用GIS扩展。我远没有模型运行,但我想知道是否最好的方式去与我的模型将是:Netlogo:Shapefile与光栅
(1)使用shapefile与农场的边界和覆盖与其他栅格地图(如欧几里得从市场距离)
或
(2)采用与代表农场小区ID的栅格。这样,我可以在属性和其他栅格地图之间有一个完美的重叠。
预先感谢您!
到了这一天的最后是去与问题的最好办法:
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
我仍然在使用shapefile,只是为了让NetLogo世界变得“漂亮”...... –
我怀疑答案取决于你打算如何使用GIS文件中包含的信息。我真正可以建议的是,你收集了几种人们已经整合了GIS的方式,并且看看最相似的东西。这是你的第一个例子。
我有一个最近的模型,有一个强大的空间组件传播流行病。流行感染力受到人口的强烈影响。我为模型中的所有国家(下拉框选择国家)在分区域一级获得了人口密度作为光栅文件。将其导入NetLogo作为补丁信息有效地调整栅格大小。然后,我将NetLogo补丁转换为实际平方公里(对于每个国家),以便为每个NetLogo补丁创建人口。
谢谢JenB,在一天结束的时候,我发现的最好方法就是将多个变量添加到补丁中。所以每个像素都有一个LOT-ID,一个LAND-USE,一个距离标记等......我会在我提出的代码之下发布。 –
如何你的尺寸相匹配?每个NetLogo单元对应的真实世界面积有多大?典型的农场有多大? – JenB