Closed JamesHovet closed 3 years ago
Thank you for all your work on this! It looks like you got all the features we talked about implemented, which is great. This mostly looks good. I left some small style comments in the code.
One issue I found in testing, I loaded the GIS General Examples code example model from the library. I added this code above the existing
setup
procedure:breed [ ciudades ciudad ] ;ciudades-own [ name ] to setup-ciudades clear-all gis:load-coordinate-system (word "data/" projection ".prj") set cities-dataset gis:load-dataset "data/cities.shp" gis:set-world-envelope gis:envelope-of cities-dataset gis:create-turtles-from-points cities-dataset "ciudades" [ set size 1.5 set shape "circle" ] end
What I noticed is that when I did not define any
breeds-own
variables (commented out theciudades-own [ name ]
), the turtles were loaded but they didn't get the position set, they were all at(0, 0)
. When I uncommented theciudades-own [ name ]
they got the position set by the dataset and also thename
values were populated. That looks like a bug to me, I'd expect all the built-in variables to be loaded and set (including position) even if the breed doesn't define any variables.
Good catch. I had the change-the-turtle-position code inside of the for-each-matching-variable-pair for loop for some reason. Fixed and added this situation as a test case.
Hey there, this looks super useful and covers a very needed addition. Any chance you know which future release this will be brought into?
@cdwren I think there is a little more work left to do on improvements, but you can expect a release of the GIS Extension through the extensions manager sometime in the next month. The updates will also be included in the next release of NetLogo desktop, but there is no timeline for that.
Add a primitive that automatically creates a set of turtles for each point in a points GIS points dataset. Each turtle created takes on variable values from their respective origin points automatically.
In addition to the above
create-turtles-from-points
primitive, there is acreate-turtles-from-points-manual
primitive that allows the user to manually specify how GIS property/field names are mapped to NetLogo variables.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: