"Gis:property-value primitive" netlogo - gis

I am using the gis extension in netlogo. I got stuck in this point:
Using the primitive gis:property-value
The line of code looks like this:
gis:set-drawing-color scale-color red (gis:property-value ? "POPULATION") 5000000 1000
I do not know what population and 5000000 1000 means , I mean I assign that name (population) and values (5000000 1000) or they are values that are already written in the .shp file.

"POPULATION" refers to something that already exists in the .shp file. I imagine it would show up if you browsed the contents of the file using standard GIS tools.
As for 5000000 1000, these are inputs to the scale-color primitive, to translate a range of population values to a range of shades of red. See http://ccl.northwestern.edu/netlogo/docs/dictionary.html#scale-color , and see also the Scale-color Example model in the Code Examples section of NetLogo's Models Library.
The number 500000 was apparently chosen by the model author based on their prior knowledge of the range of population values they expect to appear in the input file.

according to gis-extension manual gis:property-value is used like gis:property-value VectorFeature property-name to with this small peace of code, I guess your in a foreach loop. The ? is the shp ID in the loop for the "POPULATION" column and 5000000 1000 seem to be the value for this polygon!

Related

Trying to contour a CSV file in QGIS

I have rainfall data which I have imported as a csv file. It's 185 lines like this:
Name, Longitude, Latitude, Elevation, TotalPrecipitation
BURLINGTON, -72.932, 41.794, 505, M
BAKERSVILLE, -73.008, 41.842, 686, 42.40
BARKHAMSTED, -72.964, 41.921, 710, M
NORFOLK 2 SW, -73.221, 41.973, 1340, 44.22
Looking at the layer properties the latitude and longitude are brought in as "double" but the rainfall amounts come in as "text" so I can't contour them.
How can I get beyond this point and where do I go to do the contouring? Do I go to Vector:Contour? Will it understand M is missing data or will the Ms still exist if this is converted to "double?"
I'm a little confused. Thanks for the help.
I think I might have the idea of help.
Since you have the sort of points located randomly across some area you could do as follows:
Load CSV to your QGIS in order to set the point layer with an attribute table including your most important value, which is Total Precipitation. Let's call it the TEST layer
Processing Toolbox -> TIN Interpolation -> Select the TEST layer. As an Interpolation attribute choose "Total precipitation". Use the green "+" symbol for adding this selection. Don't forget about the Extent option, where you could define the bounds of your interpolation. Preferably I wouldn't exceed the layer I am working on. Output raster size is also important - avoid a small number of rows. Put them about 10 optionally in order to make your interpolation efficient.
https://www.qgistutorials.com/en/docs/3/interpolating_point_data.html
Main bar -> Raster -> Extraction -> Contour
In the input layer select TEST, Interval contours between lines can be 10 (10mm in your case), Attribute name - put PRECIPITATION -> click Run
Your precipitation lines are ready! Now, you can Right-Click -> Properties -> Symbology (change color) or _>Labels (provide labels based on your attribute column Total Precipitation).

What is the "predictions for different feature values" curve in a catboost feature plot?

The plot I am referring to can be found here. It is reproduced by calling the calc_feature_statistics function.
It is clear to me what the blue and orange curve (mean target and mean prediction) represent.
What is the red line(predictions for different feature values) ?
from the link:
To calculate it, the value of the feature is successively changed to fall into every bucket for every input object. The value for a bucket on the graph is calculated as the average for all objects when their feature values are changed to fall into this bucket.
As far as I understand these words the explanation is as next:
for example you've got categorical feature with three possible values: 'Moscow', 'London', 'New York'. Then:
Let's set all values of this feature in train data as 'Moscow' and
calculate average prediction among all of the data with the model we
trained earlier. This will be the dot of red line for bucket
'Moscow'
Repeat previous step with value 'London' --> this will be dot of red line for bucket 'London'
Same for New York.

Netlogo - Importing a Shapefile and counting the number of entries on each patch

I have a shapefile containing the location of several thousands of people. I want to import this and for each patch, I'd like to count the amount of people on this exact patch (each person is an entry in the shape file, but multiple people can be located on the exact patch depending on my world size).
I have managed to do so using the following code:
set population-here 0
let population-dataset gis:load-dataset "population_file.shp"
foreach gis:feature-list-of population-dataset [a ->
ask patches gis:intersecting a [
set population-here population-here + 1]
However, it takes several hours to load the dataset in a world of -300 to 300 pixels. Is there a faster way of counting the number of individual entries for each patch?
The population should be placed on an underlying shapefile of an area. This area is imported as following:
let area-dataset gis:load-dataset "area.shp"
ask patches [set world? false]
gis:set-world-envelope gis:envelope-of area-dataset
ask patches gis:intersecting area-dataset
[ set pcolor grey
set world? true
]
Okay, I can't test this and I'm not entirely confident in this answer as I use GIS very rarely. But I suggest you adapt the code in the GIS general examples in the NetLogo model library (see File menu). What you appear to want to do is create a turtle breed for your people, and create a person at each location where there is a person in your population dataset.
breed [people person]
patches-own [population]
to setup
< all the other stuff you have >
let population-dataset gis:load-dataset "population_file.shp"
foreach gis:feature-list-of population-dataset
[ thisFeature ->
[ let location gis:centroid-of (first (first (gis:vertex-lists-of thisFeature )))
create-people 1
[ set xcor item 0 location
set ycor item 1 location
]
]
]
ask patches [ set population count people-here ]
end
You can also import other variables from the population set (eg gender or age group) and have those variables transfer to appropriate attributes of your NetLogo people.
If you haven't found it yet, I recommend this tutorial https://simulatingcomplexity.wordpress.com/2014/08/20/turtles-in-space-integrating-gis-and-netlogo/.
Note that this assumes there is a reason why you want the people in the correct (as defined by the GIS dataset) position for your model rather than simply having some sort of population count (or density) in your GIS file and then create the people in NetLogo on the correct patch.

Netlogo - GIS Movement History of Turtles

I've got a Netlogo model running on a couple of raster layers which I imported using the GIS extension. All good so far
Next, I'd like to record and export the movement history of my turtles (in real world coordinates), along with the turtle number and the tick number.
I've looked at writing out xcor and ycor but that's not much help as I need GIS locations. I've also looked at hatching a separate breed (tracker) at each turtle location to store the locations and then exporting the tracker breed at the end using gis:store-dataset. But this substantially reduces the run speed of the model, even for a relatively small number of turtles, to the extent that it's almost unusable. I also can't figure out how to get the turtle number into the tracker breed.
Does anyone have any bright ideas of alternative faster approaches and which also include the turtle number?
Key elements of existing code are
breed [ tracker trackers ]
trackers-own [ tick_no ]
ask turtles [
my-move-turtles-routine
hatch-trackers 1 [
set hidden? true
set tick_no ticks
]
]
gis:store-dataset gis:turtle-dataset trackers "tracking"
Many thanks
What kind of output are you looking for? Are you writing this out to a csv?
I think this to-report procedure outputs what you need (when called by a turtle) but you will likely have to modify it or split it into multiple pieces depending on your desired output format.
to-report turtle-coords-who-tick
let t_env gis:envelope-of self
let x first t_env
let y last t_env
let me who
report ( list x y me ticks)
end

Sketchup 3D Models, DEM and Netlogo GIS Extension

Bit of a challenge here which I've been grappling with for some time. I'll explain my full work flow so you can reproduce if needed.
I'm creating virtual landscapes in Google SketchUp which I ultimately would like to use in Netlogo to examine how turtles interact with them.
My problem is that by the time I get the landscapes into Netlogo the units don't seem to relate to the original 3D model.
Step 1: Create simple hill on a 50m by 50m square in Sketchup using the Toposhaper extension.
Step 2: Export to .dae file and import into Meshlab, ensure the Meshlab model has the same dimensions as the Sketchup model by adjusting the units with the assistance of the measuring tool. Export from meshlab as .xyz file.
Step 3: Import .xyz file into QGis as points by adding a new layer from delimited file. Selecting field_1 and field_2 as X and Y fields.
Step 4: Create raster of points using Raster > Interpolation > Interpolation. Add field_3 as interpolation attribute, set number of columns to 50 by 50 (to correspond to the 50m x 50m 3D model), adjust cell size X and Y to match to ensure Netlogo will read the resulting .asc file.
Step 5: Finally, I setup a model in Netlogo to receive the raster. Firstly, in model settings I set the the min and max pxor and pycor to 0 and 50. Then, using the Gis Extension, I import the raster apply the z-value to a patch variable called elevation:
to load-gis
set elevation gis:load-dataset "cone_50.asc"
gis:set-world-envelope-ds gis:envelope-of elevation
gis:apply-raster elevation target-elev
end
Now, each patch of my 50 by 50 Netlogo world should have an elevation value taken from my 50 by 50 raster. In theory, adding all the elevation values together should (roughly) give me the total volume of the raised area of the hill? The figure I get is higher however and the problem gets worse with larger volumes.
Can anyone help?