MetaABM now provides support for representing GIS based models and artifacts, and provides a number of tools that should make the whole process less taxing!
First, you need to install metaABM, install Repast for metaABM, and setup a project. Create a new repast project instead of Ascape (poor old Ascape doesn't have a built-in GIS component), and create a new metaABM model -- let's be creative and call it "GIS".
Did you get a zillion errors? You probably forgot to tell Eclipse where to find Repast. See install Repast!
You should end up with something like this:
Now, right-click on the GIS root context, and select "Create Member:Geography"
Click the Geography you've created, and select "Import GIS Agent..."
You need to select Geograhy to do this trick. That's because we're importing the agent using a specific geographical context. metaABM and Simphony allow the creation of multiple geographies so we want to specify an association.
Find the statepop.shp file. It's located in your Simphony installation folder in plugins/repast.simphony.gis/sampleData. This is what it looks like using the nifty file dialog in OS X.
KA-CHING! Or something like that..
A lot of stuff there. First, you might want take a look at the attributes. These have types assigned according to the .shp file meta-data.
I've rearranged the Eclipse environment a bit here -- no need to worry about that, but one of the nice things about Eclipse is that it is very customizable.
You might notice that Strings are "Symbol" and doubles are "Real". This is intended to make the representation more general. For example, you might want to use rational numbers instead of floating points. Don't worry, as these are translated back into doubles in the model.score file, Java source and other artifacts.
We can close the attributes (click the triangle or similar UI widget) and select the default style. This doesn't do much at the moment -- we're working on style generators for Repast to provide generality, but the built-in tools within the Simphony environment are very nice. Note that the style is aware of what kind of shape we have; in this case it's a polygon.
And if we click on the "Load StatePop.1s" Act we can see how an agent loader is defined. It is the same as an agent creator, except in this case we specify a source file. If you want to change the location of the files later this is the place to do it.
Whenever possible, use a "real" URL such as a publically available web page to allow others using your models to access your data. You can also use relative locations and the Eclipse EMF environment even provides a way to specify local proxies for URLs, though now we are getting way outside of the scope of this tutorial.
Nearly forgot, at this point you should save the model. The model should build quite quickly and absent any nasty red markers, you can move on to using the shape file in Repast.
What was the point of doing all of this? Well..
First, we can run the model!
Click the run button (VCR forward), and the map comes up.
If you select the probe tool on the far right of the GIS display and drag within a state, you can see the state properties. All of the data has been brought in automatically and transparantly. This takes advantage of a number of metaABM and Simphony features.
All shape formats "should" be supported. For example, you could import a road (line) layer instead.
All of the model parts are now available for defining agent behaviors using metaABM Acts. (Examples of this functionality to come.) You can also use Plain Old Java or other tools for development. See Using Java with metaABM for more ideas.