I need to create turtles of breed “house” that are located on a polygon. Each polygon has an attribute
CODE,
which is an unique value, and that value must be assigned to each house in its attribute
c_commune.
I am usig this procedure:
to draw-houses
foreach gis:feature-list-of comuna-dataset [
this-comuna ->
let prop_houses gis:property-value this-comuna "Prop_v"
let code gis:property-value this-comuna "CODIGO"
let houses-in-comuna round (prop_houses * number_houses)
gis:create-turtles-inside-polygon this-comuna houses houses-in-comuna [
set shape "square 2"
set size 0.5
set color blue
set c_comuna code ; it is displaying the last value
set label c_comuna
]
]
end
The problem is the double loop made by foreach
gis:feature-list-of
and
gis:create-turtles-inside-polygon
blocks, which are overwriting the last value for all houses (turtle), and they end up with the same value.