Wednesday, September 05, 2018

Creating Simulations with Leaflet Maps

AgentMaps is a new LeafletJS plug-in that allows you to create animated social simulations on an interactive map. These social simulations can take the form of simulated neighborhood commuting patterns, the spread of an epidemic in a town, traffic flow around an intersection or anything else that requires modelling the flow of agents around a location on a map.

AgentMaps allows you to build and visualize dynamic social systems on top of a Leaflet map. For example this demo of AgentMaps simulates the spread of an epidemic around a neighborhood as the residents move around and interact. Given a defined location (which can be anywhere in the world) AgentMaps can add dynamic units or agents to the map, schedule the units to move between different locations and change the appearance and properties of the agents. Here is another demo which shows the different ways agents can move around a Leaflet map.

In order for the agents to be able to navigate a neighborhood the neighborhood streets have to be defined in AgentMaps. The data for the streets therefore needs to be defined in a GeoJSON file. The AgentMaps documentation shows you how you can create this GeoJSON data with the Overpass API or using the OpenStreetMap web interface.