At The AnyLogic Conference 2013 I announced results of my recent research regarding GIS alternatives for AnyLogic and would like to share my experience. Using open source projects, a small amount of Java code and publicly available GIS data services, I was able to:
- Display Tile map on model presentation with pan and zoom. Downloaded tiles are cached in model folder.
- Switch different tile sources in runtime.
- Display animation of agents living in GIS space shown on top of map.
- Perform geocoding/reverse geocoding by parsing http query response.
- Get routing data by parsing http query response.
I created an AnyLogic library that takes care of showing map in your model. It consists of two objects:
- TileGIS: takes an empty radiobutton as a placeholder for displayed map
- TileSourceSelector: should be linked to TileGIS object and allows switching sources for tiles using its animation
This library has just some basic functionality, which already provides great capabilities though.
Currently it supports two types of map specific objects displayed on top of the map:
- PointOverlay: used to display points on the map as a circle with some text.
- PathOvelay: designed to display routes on top of the map.
In addition to this, TileGIS component is able to display AnyLogic agents living in GIS space (you will need a dummy AnyLogic GIS map in your model and Environment to specify GIS space).
Once the tile-based map was in place, I wanted to display OpenStreetMap data on top of the map. MapQuest Open initiative provides different APIs for retrieving OSM data. Most of MapQuest APIs require a key, which is provided after a free registration.
Next, I was able to perform a map search and send requests for geocoding and routing. All responses are returned as JSON objects, which are parsed using json-simple toolkit. I needed just basic data from these responses, so I didn't parse them completely.
This technology dramatically extends GIS capabilities of AnyLogic models. It's fast in comparison to shape file based GIS, consumes less memory, provides access to huge database, etc. There's also the ability to set up your own OSM mirror providing both data and tiles (with your own rendering styles).
Don't forget to take care of all components' license restrictions, including online data.
You can download a library and usage example here.
Please see additional useful links below and feel free to contact me regarding this project. I greatly appreciate any feedback and requests for additional functionality.
Head of Consulting Department
The AnyLogic Company
Other useful links:
Alternative routing with offline capabilities (cached routing graph, fast and offline): http://graphhopper.com/
Geocoding/Reverse geocoding/Map search: