【问题标题】:NetLogo, how to hatch a turtle at a certain distance on Gis layersNetLogo,如何在 Gis 层上以一定距离孵化一只乌龟
【发布时间】:2014-07-15 14:39:35
【问题描述】:

我的补丁包含海拔等属性:

set mnt gis:load-dataset "F:/StageM2/Modelisation/Modele/mnt.asc"
gis:apply-raster mnt alt
gis:set-transformation (list 567887.504252 573503.504252 6183200.86463 6187628.86463)  (list min-pxcor max-pxcor min-pycor max-pycor) 

gis:set-world-envelope gis:envelope-of mnt

海龟是从森林栅格中创建的:

to import-foret93
set foret-93 gis:load-dataset "F:/StageM2/Modelisation/Modele/foret76_93.asc"
gis:apply-raster foret-93 f93

用 [f93 = 1] 询问补丁 [ 设置 pcolor 黑色 设置foret93?真的 ;用 [foret93? 询问 n-of 2813 个补丁? =真] [孵化2813]

sprout-arbres 1 [set color pink
  set size 4]

] 结束

图层具有相同的空间参考:RGF1993,因此以米为单位。

现在,我想从现有的海龟中创建新的海龟,并在距离海龟 150m 的半径范围内随机创建新海龟(新海龟可以在 1m 或 130m 处孵化)。例如,我只要求一只海龟在一个名为 dispersal-dist 的界面中的输入框给出的距离内孵化一只海龟。

to disp-graines
ask turtle 2918
[
hatch-arbres 1
  [
  let seedX xcor
  let seedY ycor
  let ran-bear random 360
  lt ran-bear

 move-to one-of patches in-radius dispersal-dist

  set color magenta
  set size 15 
  ]
 ]

  end

但是创建的海龟比以米为单位的分散距离更远。 我是否忘记了以米为单位转换 netlogo 比例的东西?或者是另一个问题?

提前感谢您的帮助!

【问题讨论】:

    标签: gis distance netlogo


    【解决方案1】:

    虽然在您的情况下您的栅格数据集以米表示,但您的补丁没有真实世界的比例。假设您的栅格具有方形像素,您可以使用以下内容计算补丁比例:

    let patch-scale (item 1 gis:world-envelope - item 0 gis:world-envelope ) / world-width
    

    然后您可以在现有代码中使用它:

    move-to one-of patches in-radius dispersal-dist / patch-scale
    

    如果您的栅格中的像素具有不同的真实高度和宽度,您将不得不分别针对水平和垂直维度进行补丁缩放。

    【讨论】:

      猜你喜欢
      • 2022-10-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多