gis:create-turtles-from-points
gis:create-turtles-from-points VectorDataset breed commands
For each point in a VectorDataset of points, create a turtle of the specified breed at the point’s location. For each agent variable (as defined in <breeds>-own
), if there is a property with the same name in the dataset, set that variable’s value to be the value of that property. Finally, execute any commands in the optional command block. To use generic turtles as the chosen breed, simply supply turtles
as the breed argument.
Property names and variable names are compared case-insensitively. Keep in mind that when importing shapefiles, property names may be modified for backwards compatibility reasons. The names given by gis:property-names
can always be trusted as authoritative. For manually specifying a mapping between property names and variable names, see the create-turtles-from-points-manual
primitive.
For multi-point datasets, a turtle is created at each point of multi-point feature, each with the same set of variable values.
Built-in variables such as “label” and “heading” are supported. NetLogo color numeric representations are supported for setting “color” and “label-color”, as well as the 15 default color string representations (“red”, “blue”, “black”, etc.).
As an example: say you wanted to create a turtle of breed “cities/city” for each city in a dataset of cities like the one included in the “GIS General Examples” model from the models library. The cities dataset has four properties, “NAME”, “COUNTRY”, “POPULATION”, and “CAPITAL”. To map them all to NetLogo turtle variables and set their shapes to circles, you could do this:
extensions [gis]
breed [cities city]
cities-own [name country population capital]
globals [cities-dataset]
to setup
set cities-dataset gis:load-dataset "cities.shp"
gis:create-turtles-from-points cities-dataset cities [
set shape "circle"
]
end
Take me to the full GIS Extension Dictionary