【问题标题】:NetLogo GIS: How to create random points on MapNetLogo GIS:如何在地图上创建随机点
【发布时间】:2016-03-30 12:30:24
【问题描述】:

我已经使用 GIS 扩展成功地将某个城市的 shapefile 加载到 Netlogo 中,如下所示。

使用以下代码

    extensions [ gis ]
    globals [ countries-dataset min-map max-map]
    patches-own [ mapa ]
to setup
 reset-ticks
  clear-turtles
  clear-patches
  clear-drawing
  clear-all-plots
  clear-output
  ; Note that setting the coordinate system here is optional, as
  ; long as all of your datasets use the same coordinate system.
  ; Load all of our datasets

  ; Load the dataset


  set countries-dataset gis:load-dataset "city.shp"
  gis:set-world-envelope (gis:envelope-union-of (gis:envelope-of countries-dataset))
  gis:set-drawing-color green
  gis:draw countries-dataset 1

  reset-ticks
end

to match-cells-to-patches
  cd
  ct
end

to startup
  setup
end

如何在道路上创建随机海龟

【问题讨论】:

  • 这个问题更适合gis.stackexchange.com
  • @RickyA 实际上,这是一个非常具体的 NetLogo 问题,而不是 GIS 问题,因此应该保留在 SO 中。 turtles 对 GIS 人员毫无意义。

标签: gis netlogo shapefile arcgis-js-api


【解决方案1】:

您只希望海龟沿着道路移动,还是希望它们沿着道路移动?

对于前者,尝试gis:find-featuresgis:vertex-lists-of 获取图中的所有顶点,然后随机选择一个(这会将位置限制为仅顶点)。如果您希望位置位于直线部分的某个位置,则可以计算两个连续顶点之间的点。

【讨论】:

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