![]() ![]() For example if you type in the 'command center' : 'ask patches ' loops over all patches and prints out the value of their x coordinate 23. Then in 'setup' function, in the 'ask patches' block add one line that set the 'ID' variable accordingly, using patches coordinates 'pxcor' and 'pycor' 22. You can do so by adding another 'patches-own' variable 'ID' (see image after step 25) or using built-in "plabel' 21. ![]() Find a way to enumerate patches from 1 to 9 20. For example the output should look like this: 19. On that site there is a link to the whole NetLogo dictionary, with an explanation for every command 18. You can continuously monitor the output by clicking the 'setup' function 16. Print out the average of the colors at the end of 'ask patches' loop 15. Same code as above, but this time make 75% blue and 25% redĪsk n-of (0.75 *(item 0 popu1 / 10)) patches with ]]Īsk n-of (0.25 *(item 0 popu1 / 10)) patches with ]]Īsk n-of (0.Patches-own to setup clear-all ask patches reset-ticks end to g 0 14. Same code as above, but this time make 90% blue and 10% redĪsk n-of (0.9 *(item 0 popu1 / 10)) patches with ]]Īsk n-of (0.1 *(item 0 popu1 / 10)) patches with ]] Same code as above, but this time make 60% blue and 40% redĪsk n-of (0.6 *(item 0 popu1 / 10)) patches with ]]Īsk n-of (0.4 *(item 0 popu1 / 10)) patches with ]] Make 50% of the turtles red and the remaining 50% blue.Īsk n-of (0.5 *(item 0 popu1 / 10)) patches with [ Find the population and initial colour of all of the patches inside this polygon Gis:set-drawing-color 45 gis:fill feature 2.0Īsk patches with If gis:property-value feature "SOC" = "YELLOW" [ Gis:set-drawing-color 99 gis:fill feature 2.0 If gis:property-value feature "SOC" = "BLACK" [ Gis:set-drawing-color 7 gis:fill feature 2.0 If gis:property-value feature "SOC" = "GREY" [ Gis:set-drawing-color 95 gis:fill feature 2.0 If gis:property-value feature "SOC" = "BLUE" [ ![]() Gis:set-drawing-color 15 gis:fill feature 2.0 If gis:property-value feature "SOC" = "RED" [ use this line to verify if we get the right neighbors Set myneighbors (patch-set myneighbors patches with ) Set myneighbors n-of 0 patches empty agentsetĪsk patches with [ Please read NETLOGO FEATURES in info tab for more information. Find neighbors using a txt file produced by ArcGIS Polygon Neighbors. This is the code section I believe controls the initial population/location in the "segregation" model with some modifications. However, I am unable to get the model to do little else. It does appear the model was able to read the data to draw the polygons/map, separate the census tracts and apply the color modifiers I requested. Set popu gis:property-value feature "POP65UP" Let center-point gis:location-of gis:centroid-of featureĪsk patch item 0 center-point item 1 center-point [ each polygon identifies a patch at its centroid, which records the colorįoreach gis:feature-list-of city-dataset [ Gis:apply-coverage city-dataset "DISTRICT" DISTRICT Gis:apply-coverage city-dataset "SOC" mycolor copy the color information to patches (converting vector to raster) Gis:set-world-envelope gis:envelope-of city-dataset Set city-dataset gis:load-dataset "data/LA_Harbor_Region.shp" Gis:load-coordinate-system "data/LA_Harbor_Region.prj" Currently, I've modified an existing model and have been able to add my polygons (and associated attribute information) by copying the code from the provided "segregation" model in the NETlogo library. I'm hoping I can limit the "agents" to these polygons and base the number of them off of my population data. I'm working on a simple virus model in NETlogo, and attempting to integrate spatial data. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |