在Netlogo中绘制GIS数据



我想让一只乌龟在我导入的GIS数据之上为一个区域(半径为5)上色。

请找到附件的代码行,我正在使用的是不工作。

有什么办法可以做到这一点吗?

谢谢!

extensions[gis]
globals [map-boundary]
to setup
ca
set map-boundary gis:load-dataset "/Users.shp"
create-turtles 50
ask turtles [setxy random-xcor random-ycor set size 1 set color grey]
gis:set-world-envelope (gis:envelope-union-of (gis:envelope-of map-boundary))
gis:import-wms-drawing "https://ows.terrestris.de/osm/service?" "EPSG:4326" "OSM-WMS" 1
reset-ticks
end
to go
ask turtle 1 [ask patches in-radius 5 [set pcolor blue]]
end

我不知道你的意思是"不工作",而且缺乏你的数据集,我无法重现这个问题。

Models Library有一些GIS的例子。不明显的是,Uri Walenski的"共享数据集"在哪里?文件是你需要运行它们模型,但我在这里找到了它们的一些版本:https://ccl.northwestern.edu/netlogo/5.0/models/Code%20Examples/GIS/data/当我双击国家时。SHP和国家。如果它们下载了,我就可以把它们移到我自己新的"共享数据集"上。我的模型所在文件夹下的文件夹。完成后,模型"创建-海龟-inside-polygon";运行。

我删除了大部分,并添加了一条线,在海龟#1周围画了一个蓝色区域,它似乎有效。你画蓝色区域的尝试有什么不同?

extensions [gis]
globals [dataset]
breed [citizens citizen]
citizens-own [cntry_name curr_type]
breed [manual-citizens manual-citizen]
manual-citizens-own [country-name currency-type]
to test-turtles
clear-all
set dataset gis:load-dataset "./shared-datasets/countries.shp"
gis:set-world-envelope gis:envelope-of dataset
gis:set-drawing-color red
gis:draw dataset 1
foreach gis:feature-list-of dataset [ country ->
gis:create-turtles-inside-polygon country turtles 1
;;clear-turtles
]
ask turtle 1 [ ask patches in-radius 5 [set pcolor blue]]
end

最新更新