如何在从GIS shp加载的道路(折线矢量)上移动NetLogo中创建的海龟?

时间:2019-04-29 20:27:26

标签: gis netlogo arcgis

我有居民多边形和基础设施(学校,医院等)多边形,以及来自GIS的道路折线,它们都已加载到NetLogo中。根据居住多边形的各个种群,我在其中创建了海龟。现在,我希望这些乌龟从住宅区转移到基础设施区(例如学校)。乌龟的行进距离应小于800米,并选择阻抗最小的路径(总阻抗= ImpFacRoad1 * DistanceTravelledRoad1 + ImpFacRoad2 * DistanceTravelledRoad2 ...),并且最多达到学校的容纳人数(例如10000人)。

我已经能够完成之前的步骤,例如加载shps并将龟类添加到住宅区。enter image description here enter image description here

该代码与之前的步骤有关,并且未链接到我的确切问题。仍要共享。

extensions [gis]

globals [infra-dataset
    rd-dataset
    node-dataset
    res-dataset]



 to setup
    ca
    set infra-dataset gis:load-dataset "C://Users//Riya//Desktop//NT//infra.shp"
    set rd-dataset gis:load-dataset "C://Users//Riya//Desktop//NT//rd.shp"
    set res-dataset gis:load-dataset "C://Users//Riya//Desktop//NT//res.shp"
   gis:set-world-envelope-ds gis:envelope-of lu-dataset
 ;infra
    foreach  gis:feature-list-of infra-dataset
     [[t]->
     if gis:property-value t "fac_head" = "Education" [gis:set-drawing-color red gis:fill t 2.0]
     if gis:property-value t "fac_head" = "Health" [gis:set-drawing-color green gis:fill t 2.0]
     if gis:property-value t "fac_head" = "Safety" [gis:set-drawing-color violet gis:fill t 2.0]
     if gis:property-value t "fac_type" = "Vacant" [gis:set-drawing-color cyan gis:draw t 2.0]
  ]
  ;rd
    foreach  gis:feature-list-of rd-dataset
     [[t]->
     if gis:property-value t "Width" = 18 [gis:set-drawing-color white gis:draw t 1.8]
     if gis:property-value t "Width" = 30 [gis:set-drawing-color white gis:draw t 3.0]
     if gis:property-value t "Width" = 45 [gis:set-drawing-color white gis:draw t 4.5]
  ]
; res
    foreach  gis:feature-list-of res-dataset
     [[t]->
      if gis:property-value t "Density" < 1.04 [gis:set-drawing-color yellow - 2 gis:fill t 2.0]
      if gis:property-value t "Density" > 1.04 and gis:property-value t "Density" < 1.8 [gis:set-drawing-color yellow gis:fill t 2.0]
      if gis:property-value t "Density" > 1.8 [gis:set-drawing-color yellow + 2 gis:fill t 2.0]
  ]
end

to night ; turtles stay in residential patches at night
    foreach gis:feature-list-of res-dataset
     [[t]->
      let pop ( gis:property-value t "Population" ) / 100
      let target-patches ( patches gis:intersecting t ) with [ gis:contained-by? self t ]
      if any? target-patches [
      let avg-turtles round ( pop / count target-patches )
      ask target-patches [
        sprout avg-turtles
  ]
  ]
  ]
    ask turtles [set shape "person"]
    reset-ticks
end

如何将在NetLogo中创建的海龟在从GIS shp加载的道路(折线矢量)上移动到特定距离,并基于最小阻抗(作为道路shapefile的属性提供)对道路进行优先级排序? 我期望这只乌龟从家里搬到学校。如果它能够上学,它会变成绿色,但是如果没有,它就必须搬回家并变成红色。

0 个答案:

没有答案