HOW TO: Use and Exploit the Scenario Editor of Snap4City

The Scenario Editor has been developed and enforced in Snap4City tools according to the requirements identified, with the aim of providing a versatile and easy-to-use operator tool for defining, studying, and analyzing smart city scenarios. In Figure a screenshot of a Snap4City dashboard including the proposed scenario editor is provided. As can be seen, a map is used as background while on the left and right sides of the map are placed panels and buttons that can be used to create the scenario. The save functionality is accessible on to registered users, and the registration is free of charge.

see dash with the Scenario Editor:

usability assessment:

From the scenario editor, the user can select an area of interest and modify the topology and the attributes of the road network, plus data included. Then, different kinds of IoT devices, entities, and services can be recalled and selected in order to complete the formalization of the scenario for computing and analysis phases. The aim was the definition of a powerful scenario model and tool which can be used to define the context for a huge number of context-depended computational activities (in time and space) such as those for computing people flows, traffic flow reconstructions, heatmaps, origin destination matrices, indicators, navigation, representation, etc., maybe extracting information from multiple big data spaces, knowledge bases/graphs, etc., and allowing the users to produce also hypothetical scenarios/contexts on which the computation/simulation could be performed, as in the what-if analysis. The formalization of scenarios in a flexible manner enables the assessment of the impact of changes in complex city contexts. The modeling of the scenario itself could change its status (e.g., proposed, approved, closed), evolving over time, and be shared among experts and decision makers. In the proposed scenario management, the model definition and structure is formalized as a smart data model compatible with the NGSIv2 standard for data exchange and indexed into a knowledge base for future retrieval via semantic queries. In this paper, the requirements and the formalization of the scenario and editor are presented. In addition, a case study is provided in which the scenario model and tool are used to define the context and needed to compute the traffic flow reconstruction of a portion of the city, in actual conditions and by changing some constraints enabling in this case the fast re-computation/simulation for what-if analysis. The proposed scenario model and editor have been developed and are integrated into the Snap4City platform (, an open-source IoT platform able to manage multiple tenants and billions of data with the key focus on interoperability (the tool is accessible from dashboards such as from the above link). The scenario editor is embedded as a novel module of Dashboard Builder Multi Data Map widget and is able to retrieve static (road graph, urban elements, sensor positions, etc.) and real-time (sensor readings, public transport time schedules, weather, temperature, etc.) data though specific APIs.

details about the attributes of the road elements can be found on:  

The editor can work in edit and view modalities (see the button in the bottom-left corner of the map): the former is the modality to define a scenario and introduce changes, the latter is used to load/recover display previously created scenarios, received in delegation of made public (via IoT Directory/Entity Directory). On the right side, a panel to specify scenario metadata is displayed, including fields for the scenario name, location, description, reference knowledge base, analytics and KPI to use, start and end datetimes of the scenario validity. In the top-left corner, under the buttons to set the map zoom level, controls to draw a squared or polygonal shape are provided. After having defined the shape of the area of interest, the road graph is retrieved from the specified knowledge base and shown over the map with interactive graphical elements. Roads are displayed with arrows specifying the travel direction and with different color to indicate if roads are not in use (gray, not to be considered in the scenario processing), if they are with a single (blue) or double (red) travel direction. Each road segment can be clicked to access and modify specific information/properties (see list above) (category, number of lanes, max speed, etc.). Using the button in the bottom-left corner, roads can be modified by creating, splitting, or deleting segments, dragging and joining nodes. Undo and redo actions are implemented to help the user in correcting possible errors. Entities are requested using the selector menu on the left side of the dashboard. Each selector entry specifies an entity kind (traffic, weather, air quality sensors, POIs, bus stops, etc.) that can be loaded independently into the scenario editor. Once the user completes the editing operations, the resulting scenario can be saved by sleecting data which are displayed in that moment on the map and using the selection tick. The scenario is saved as an Entity and thus you can share, make public and download (export, import) from the Entity Directory. You can also access to the scenario definition from the IoT App / Proc. Logic to manipulate, exploit and may be sent to some ML/AI process developed in RStudio / Python via Data Analytics modules, etc. 

Before saving the scenario, the system performs a consistency check on the defined road graph to highlight possible errors using the formal method. In the case the consistency check fails -- e.g., when nodes with only entering roads are detected, an alert is sent to the user and the different components are highlighted in the map. Additionally, a warning is given to the user when the system detects roads having segments with different number of lanes or different max speeds. Even if, this is something that may happen in real cases, due to the relevance of such characteristics, the system highlights suspicious cases to help the user avoiding introducing errors in the scenario.