Netlogo,在特定多边形的中心创建品种(即id=123456)
我有一个netlogo gis模型。gis形状文件由多边形形式的建筑迹线组成。我想在特定建筑的中心创建一个id为66445345多边形id的品种。没有大量的建筑/多边形,但我只对在这一个多边形创建品种感兴趣 有什么办法吗Netlogo,在特定多边形的中心创建品种(即id=123456),netlogo,Netlogo,我有一个netlogo gis模型。gis形状文件由多边形形式的建筑迹线组成。我想在特定建筑的中心创建一个id为66445345多边形id的品种。没有大量的建筑/多边形,但我只对在这一个多边形创建品种感兴趣 有什么办法吗 breed [blds bld] set guo-building gis:load-dataset "guo-building.shp" gis:drawing-color gray gis:draw guo-buildings 1.0 foreach gis:verte
breed [blds bld]
set guo-building gis:load-dataset "guo-building.shp"
gis:drawing-color gray
gis:draw guo-buildings 1.0
foreach gis:vertex-list-of guo-buildings[
i ->
let bld-no gis:property-value i "id"
let center gis:centroid-of i
let center-location gis:location-of center
if bld-no = 66445345
[create-blds 1
[
set xcor (item 0 center-location)
set ycor (item 1 center-location)
set color red
set size 5
]
]
]
解决了这个问题。需要插入blds自己的变量和存储id
breeds [blds bld]
breeds-own [building-no]
to setup-pma-locations
foreach gis:feature-list-of guo-buildings[
i ->
let bld-no gis:property-value i "ID"
let center gis:centroid-of i
let center-coordinates gis:location-of center
if not empty? center-coordinates [
create-blds 1
[
set xcor (item 0 center-coordinates)
set ycor (item 1 center-coordinates)
set color red
set size 0
set building-no bld-no ;store in blds-own variable
]
]
]
ask blds[
let pma blds with [building-no = "66445345"]
ask pma [set color red
set size 5]
]