So I have a series of GIS points on a map and Truck agents travel from point to point at random. There's a series of arbitrary non-overlapping regions within the map (akin to county or state). I'm trying to track which GIS Region the Truck is in as it travels from point to point.
My approach is to have a GIS Region variable within the Truck agent called county and follow the logic here: How to set regions as a parameter in an agent in anylogic
But rather than have it in the On startup field, have it in the On step field. So it would be as such
county = main.map.searchFirstRegion(address);
I am receiving these error states
main cannot be resolved
address cannot be resolved to a variable
Any clue how to troubleshoot? Very green to AnyLogic so if I'm overlooking something simple, please let me know.
BONUS:
Additionally, if I have each GIS Region is an agent, say County. I'm unsure how I could calculate an agent variable that comprises the summation of all Truck agents currently in that GIS Region (i.e. Truck count in County or Total freight weight in County).