Each 'Person' has a parameter 'region' which into which I map the value of the 'region' column in my table to. I then need to find some way to set the position of the agent to a random point inside the assigned region.
I have tried:
GISRegion myRegion = main.map.searchFirstRegion(region);
Point pt = myRegion.randomPointInside();
setXYZ( pt.x, pt.y, pt.z );
in the "On startup" field for my Person Agent but it seems that main.map.searchFirstRegion(region); does not do a good job of getting the correct region, as agents are distributed in places where there is no region (i.e in the sea):
Image
Ideally, I would like to use void setLocation(region) but setLocation takes in a Point or INode variable whereas the 'region' parameter is a string. Is there a way to search the list of regions by name for the matching region and return that region?
Thanks!