我在netlogo中使用GIS扩展来创建模型以读取shapefile。我有代表国家公园的多边形和代表狮子的点。点和公园的多边形显示没有任何问题。但是,我想从点上创造海龟,这就是我遇到问题的地方。当我这样做时,海龟会改变位置。它们以相同的模式排列,但它们扩散并占据整个网络世界,而不是公园内的一个小集群。
extensions [gis]
globals [lion-dataset park-dataset]
to setup
ca
reset-ticks
;; import national park shapefile
set park-dataset gis:load-dataset "H:/college/reserve_lion.shp
gis:set-drawing-color green gis:fill park-dataset 2.0
;; read in turtle dataset and draw
set lion-dataset gis:load-dataset "H:/college/lion.shp
gis:set-drawing-color red gis:fill park-dataset 2.0
breed [lions lion]
;; creating the turtle from lion-dataset
foreach gis:feature-list-of lion-dataset
[ let location gis:location-of gis:centroid-of ?
if not empty? location
[ create-lions 1
[ set shape "person"
set size 1
set color red
set xcor gis:property-value ? " x_park"
set xcor gis:property-value ? " y_park"
show "world loaded"
end
to go
ask lions
[move]
tick
end
to move
fd 3
rt 3
end