Netlogo:Shapefile 与光栅
Netlogo: Shapefile versus Raster
我目前正在使用 NetLogo 中的一个模型来模拟一些农场的土地利用变化。为此,我需要在 NetLogo 中使用 GIS 扩展。我还远没有模型 运行 但我想知道使用我的模型的最佳方法是否是:
(1) 使用带有农场边界的 shapefile 并将其与其他栅格地图(例如距市场的欧氏距离)叠加
或
(2) 使用具有表示农场的像元 ID 的栅格。这样,我就可以在属性和其他栅格地图之间实现完美重叠。
提前致谢!
我怀疑答案取决于您打算如何使用 GIS 文件中包含的信息。我真正能建议的是,您可以收集人们集成 GIS 的几种方式,然后看看哪种方式看起来最相似。这是给你的第一个例子。
我有一个最近的模型,它具有强大的传播流行病的空间成分。流行病的传染性受人口影响很大。我获得了模型中所有国家的次区域级别的人口密度(下拉框 select 国家)作为光栅文件。将其作为补丁信息导入到 NetLogo 中可以有效地调整光栅的大小。然后我将 NetLogo 补丁转换为真实世界的平方公里(对于每个国家/地区),以便为每个 NetLogo 补丁创建人口。
到今天结束时,这是解决问题的最佳方法:
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
我目前正在使用 NetLogo 中的一个模型来模拟一些农场的土地利用变化。为此,我需要在 NetLogo 中使用 GIS 扩展。我还远没有模型 运行 但我想知道使用我的模型的最佳方法是否是:
(1) 使用带有农场边界的 shapefile 并将其与其他栅格地图(例如距市场的欧氏距离)叠加
或
(2) 使用具有表示农场的像元 ID 的栅格。这样,我就可以在属性和其他栅格地图之间实现完美重叠。
提前致谢!
我怀疑答案取决于您打算如何使用 GIS 文件中包含的信息。我真正能建议的是,您可以收集人们集成 GIS 的几种方式,然后看看哪种方式看起来最相似。这是给你的第一个例子。
我有一个最近的模型,它具有强大的传播流行病的空间成分。流行病的传染性受人口影响很大。我获得了模型中所有国家的次区域级别的人口密度(下拉框 select 国家)作为光栅文件。将其作为补丁信息导入到 NetLogo 中可以有效地调整光栅的大小。然后我将 NetLogo 补丁转换为真实世界的平方公里(对于每个国家/地区),以便为每个 NetLogo 补丁创建人口。
到今天结束时,这是解决问题的最佳方法:
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