我是 NetLogo 的新手,目前我希望模拟乌龟在路上移动。我已经从 OpenStreetMap 下载了街道地图,并将其转换为 shapefile(仅道路),以便它与 NetLogo 兼容。但是当我使用 GIS 扩展导入道路并运行代码时,NetLogo 似乎找不到任何道路(蓝色),因此无法在道路上创建海龟。
extensions [gis]
patches-own [vlocation]
to setup
clear-all
ask patches [ set pcolor white ] ;;set background white
end
;;import the road downloaded from OpenstreetMap
to load
let view1 gis:load-dataset "map11_osm_ln.shp"
gis:set-world-envelope gis:envelope-of view1
foreach gis:feature-list-of view1
[
gis:set-drawing-color blue ;;draw road as blue
gis:draw view1 0.5
]
end
to add-turtles
create-turtles 1
ask turtles ;; create turtles on road which is blue only
[
set vlocation one-of patches with …Run Code Online (Sandbox Code Playgroud)