使用 NetLogo 中的 gis 扩展 我的目标是将一个大型矢量上传到 NetLogo 中。
在 apply-coverage
命令和以下代码行之间,我选择了以下代码,因为它们速度更快并且会产生相同的结果(我使用 export-world
命令进行检查。
以下代码行的灵感来自 this< /a> 来源和 Brooks 的《基于代理的建模和 GIS》一书(2019 年)。
这个想法是将每个多边形的属性应用到每个面片的质心以便使用。
let n 1
foreach gis:feature-list-of Parcels_2015 [
polygone ->
let center-point gis:location-of gis:centroid-of polygone
let x-coordinate item 0 center-point
let y-coordinate item 1 center-point
ask patch x-coordinate y-coordinate [
;; set an ID to the patch
set ID_temp n
set ID_Parcel gis:property-value polygone "ID_PRCL"
;; and others....
;; we set the variables of each patch
set LU gis:property-value polygone "LUCTGRY"
;; and other variable....
;;and color the map depending on the LUCTGRY
if gis:property-value polygone "LUCTGRY" = "Extensive grassland" [
set pcolor green
]
set n n + 1
]
]
然而,我意识到这些补丁仍然是“方形”,并不代表“现实世界”。

之后,我增加了 NetLogo 贴图,这样两个补丁就不会出现了相同的包裹,见下文:

但是,在我的代码的下一行(尚未编写)中,目标是与相邻的补丁一起使用。如果您查看图片,您会发现,标识一个地块(彩色)的补丁是不代表任何内容的补丁的邻居。
那么最后,真的有可能用“连续”矢量 GIS 数据填充 NetLogo 世界吗?
Using the gis extension
in NetLogo I aim to upload a large vector into NetLogo.
Between the apply-coverage
command and the following lines of codes, I picked the following because they are faster and lead to the same results (I checked using the export-world
command.
The following lines of code are inspired by this source and the book "Agent-based Modeling and GIS" by Brooks (2019).
The idea is to apply the attributes of each polygon to the centroid of each patch in order to be used.
let n 1
foreach gis:feature-list-of Parcels_2015 [
polygone ->
let center-point gis:location-of gis:centroid-of polygone
let x-coordinate item 0 center-point
let y-coordinate item 1 center-point
ask patch x-coordinate y-coordinate [
;; set an ID to the patch
set ID_temp n
set ID_Parcel gis:property-value polygone "ID_PRCL"
;; and others....
;; we set the variables of each patch
set LU gis:property-value polygone "LUCTGRY"
;; and other variable....
;;and color the map depending on the LUCTGRY
if gis:property-value polygone "LUCTGRY" = "Extensive grassland" [
set pcolor green
]
set n n + 1
]
]
I have however realized that the patches remain "square" and do not represent the "real world".

Afterward, I increased the NetLogo map so two patches would not be on the same parcels, see below :

However, in the next lines of my code (not yet written), the goal would be to work with neighboring patches. If you look at the picture, the patch identifying one parcel (in color) is the neighbor of a patch representing nothing.
So in the end, is it really possible to populate a NetLogo world with "continuous" vector GIS data ?
发布评论
评论(1)
是的,但不是,但也许吧。这取决于您实际需要做什么。 GIS 中的栅格数据集是这个“问题”的一个很好的例子 - 它们是现实世界数据的离散表示,但通常分为单元/网格。例如,海拔有时以 20-30 米的单元表示 - 这并不意味着整个单元具有相同的海拔,但我们如何在数字世界中表示现实世界的“模拟”数据存在限制。 NetLogo“世界”是类似的 - 您可以通过更改补丁大小来修改您的世界的分辨率,以最好地让您探索手头的问题。如果您使用非常小的补丁大小(相对于您的空间数据集)并使用诸如
gis:apply-coverage
之类的内容,您可能会获得连续世界的一个不错的近似值 。您可以查看名为“GIS 梯度示例”的模型库示例,了解网格系统中表示的“连续”现实世界数据的示例。或者,您可能会发现 gis:have-relationship? 或
gis:relationship-of
函数将允许您探索不同地块的关联方式,并可能以这种方式处理事物。然而,如果这些选项中的任何一个有效,这实际上取决于您的需求/目标。Yes, but no, but maybe. It depends what you actually need to do. Raster datasets in GIS are a good example of this 'problem'- they are discrete representations of real-world data, but typically broken up into cells / a grid. For example, elevation is sometimes represented in 20-30 meter cells- that doesn't mean the whole cell is the same elevation, but there are restrictions in how we can represent real world 'analog' data in a digital world. The NetLogo 'world' is similar- you can modify the resolution of your world by changing the patch sizes to best allow you to explore the question at hand. If you use a very small patch size (relative to your spatial dataset) and use something like
gis:apply-coverage
, you could likely get a decent approximation of a continuous world. You could check out the Model Library example called "GIS Gradient Example" for an example of 'continuous' real-world data being represented in a grid system.Alternatively, you may find that the gis:have-relationship? or the
gis:relationship-of
functions will allow you to explore the way that your different parcels are related, and potentially process things in this way. However, it really will depend on your need / goals if either of these options would work.