NetLogo 7.0.0-beta2:

gis:create-turtles-inside-polygon

gis:create-turtles-inside-polygon VectorFeature breed n commands

Randomly create “n” turtles of the given breed within the given VectorFeature and for each agent variable (as defined in -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-inside-polygon-manual primitive.

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 had a VectorDataset of polygons representing different zip codes within a state and you want to create 100 different turtles within each zip code and have each turtle know which zip code it originated in. The VectorDataset has a field named “zip”, so you should add a variable named “zip” to the turtles with turtles-own. Then, loop through each VectorFeature in the VectorDataset and use the create-turtles-inside-polygon primitive to create 100 new turtles.

extensions [gis]
globals [dataset]
turtles-own [zip]

to setup
  set dataset gis:load-dataset "dataset.shp"
  gis:set-world-envelope envelope-of dataset
  gis:set-drawing-color red
  gis:draw dataset 1

  foreach gis:feature-list-of dataset [ this-vector-feature ->
    gis:create-turtles-inside this-vector-feature turtles 100 [
      set shape "person"
    ]
  ]
end

Take me to the full GIS Extension Dictionary