A guide to using the Map view.
The Map view allows you to plot your geographical data onto a map. It allows you to specify an optional base map style and to create and configure a number of layers which will be overlaid on top of the map.
The Map view currently supports the following layers:
- Point. A series of geographic locations derived from your report data, displayed as markers. You can configure the colour, opacity, outline, label and tooltip for each point.
- Line. A series of geographic lines derived from your report data ("polylines" - outlines, coastlines, roads etc.). You can configure the colour, opacity, thickness, label and tooltip for each line.
- Area. A series of geographic areas derived from your report data ("polygons" - countries, states, etc.). You can configure the colour, opacity, outline colour, outline opacity, label and tooltip for each area.
- Geo data file. Points, lines and areas derived from a static geographic data file. Omniscope currently supports Shape files (SHP), KML/KMZ and GeoJSON. You can optionally join the Geo file data with your report data.
- Image. A static image displayed on the map, geo-located.
- Video. A video displayed on the map, geo-located
In this example we are going to create a simple dashboard that will display UK road traffic accident data. We will create a Map view that consists of two layers; a Point layer where each point represents a single accident and a GeoFile layer consisting of the UK regions. Our dashboard will allow a user to select a region in a drop-down to show the location of the accidents in that region on the Map.
Preparing the data
Firstly, we need to download the data for our dashboard.
There are many sites online that host datasets which we can use to create an Omniscope dashboard. In this example we download our data from data.gov.uk. This site contains a large number of datasets published by various UK Government departments, ranging from traffic statistics to crime figures. The data can be used for private or commercial purposes.
To find the data, open the search page and search for "road safety data". The data we are looking for should be the first result displayed.
The Road Safety Data provides detailed information regarding accidents in GB from 1979 to 2019. The entire dataset contains approximately 50 files, organised by year and data type, describing accident information, vehicles, breath test screening and blood alcohol levels.
In this example, we are not going to build a dashboard using all of these files (although Omniscope is more than capable of doing so). Instead we are going to focus on accidents in 2018.
Select the file "Road safety Data - Accidents 2018" to download the CSV file to your computer.
Open Omniscope and create a new file. In the workflow, add a "File" block and select the CSV file you previously downloaded.
We can examine the data within the workflow by clicking on the "Data" tab in the File block options.
In the table we can see that each record in this file represents a single accident. A large amount of data has been captured about each accident, including the number of vehicles involved, the type of road and even data on the weather and light conditions. The chart at the top provides some useful information about the structure of each field. Crucially this data contains Longitude and Latitude data for every accident, allowing us to plot the data on the Map view.
Before we start to create our dashboard we need to do a little data preparation. There are a number of fields in the data with lookup ID values. Fortunately the data.gov.uk site provides us with a lookup data guide, so we can match the ID to the display value.
Download "STATS19 Variable lookup data guide" to your computer. This file is a Microsoft EXCEL file with a number of worksheets. Each worksheet supplies the lookup data for a single field, allowing us to match the lookup code with the display value.
In this example we are going to add the lookup data for two fields: "Accident severity" and "Local Authority".
We use a Join block to join the data from our accident file with the lookup data. We then use a Field Organiser block to rename the lookup field.
Note: We are planning to develop a "Lookup Data" block which will allow you to perform this process much easier, without having to resort to multiple joins.
If we execute this workflow we see the following result:
We can see that the codes have been replaced by the display value, allowing us to proceed with putting together our dashboard.
Creating a dashboard
Connect the workflow to a new, blank, Omniscope report, and add a Map view. Without any configuration Omniscope will detect the Longitude/Latitude fields and display the record data.
Note: The view currently truncates the data (with a warning) at 100,000 displayed points, for performance; you will be able to use Clustering to avoid this for larger datasets.
By default Omniscope provides us with a number of different base map styles. Lets change the Map base style to "Dark".
Open the view options and you should see a "Map base style section".
Select the "Dark" choice.
Right now we see a lot of points on top of the UK. Each point represents a single accident. Lets edit the layer options to adjust the point styling.
Now expand the "Layers" section in the View options. You can see the Point layer added automatically when you first created the view. The ">" button allows us to show the options for that layer. In addition we have buttons to remove, hide and re-order the layer.
Show the layer options by clicking ">" next to the layer name. The layer is configured with a number of default options for the size, colour, opacity and outline of the points. Lets start by making the points smaller and changing the colour:
You should see the effect of this change in the Map.
What makes the Map view really powerful is the ability to use data driven styling. We can bind any attribute to any field in our report data. In this case we are going to colour the points by the accident severity. Before we do this we will modify the colour assignments in the "Accident severity" field. Select the "Data" tab in the options and locate the "Accident severity" field. Click on the button to the right of the name and select a colour for each severity value.
Now switch back to the layer options. In the "Point colour" section tick the "Data driven" checkbox and select the "Accident severity" fields.
We should now see each point coloured by the severity of the accident; Red for fatal, purple for serious and green for slight (or whatever colours you decided would be appropriate). As expected, thankfully, the vast majority of accidents are slight.
Now we are going to add a new Geo File layer containing UK region areas. Before we do so let's hide the Point layer so we can focus on our new layer. Select the toggle visibility button in the Point layer to hide it.
We will download data for the Geo file layer from the data.gov.uk website.
Perform a search for "Local authority districts" and in the filter select "GeoJSON".
There are a number of results, in this example we select "Local Authority Districs (December 2009) Ultra generalised Clipped Boundaries in Great Britain". The website provides a number of different data formats for the boundary data. Omniscope supports GeoJSON, JML and Shape files, so in this case lets select "GeoJSON" to download the data to our computer.
Note: GeoJSON is the best format if available, as it is the format natively understood by the view. However SHP and KML files will be converted automatically. The view only supports WGS84 based geographic data, which is the most common global system; if you have country-specific data (such as a national grid coordinate system), you will need to convert the data using an external tool, currently.
Now switch back to our Omniscope report. In the Map view options Click "Add layer" and select "Geo data file".
Expand the layer. In the Source section, choose "Project attachment" and click the upload button and select the GeoJSON file we downloaded. Alternatively, drag the GeoJSON file directly onto this option.
After selecting the file Omniscope automatically detects the geometry inside the GeoJSON as Area, and the layer is overlaid on the map.
Now let's hide the base map altogether; the base map can be too distracting at particular zoom levels for data visualisation. Open the base map section, and select "None (no base map)".
The Geo File layer allows us to configure the area geometry styling (colour, opacity and outline). As was the case for the Point layer, we can also use data driven styling bound on a property in the GeoJSON. In this case we are going to colour and label by the field "lad09nm". This field contains the name of the local authority district.
Now we should see each district labelled and coloured according to the district name.
We now need to link our GeoFile data with our accident data. In order to do so we need to join the data on a shared key, in this case the local authority name. We know this data exists a both a field in the report data (our accident data) and as a property in our GeoJSON file.
Open the Geo file layer options, scroll down to the "Source" selection and select "Join geo file with report data". Now select the field in the geo file (lad09nm) and the field in our accident data (Local authority). Ensure "Intersect data" is ticked. This ensures that only matching data is displayed.
Once we have joined the data we instantly see some of the Local Authority districts have disappeared from the map.
These districts have disappeared because they cannot be matched on the data. If we do a little investigation we can see that the reason for their disappearance is because the names do not match.
Note: We plan to improve the process of diagnosing and fixing joins.
We can use the Search/replace block to in the workflow to fix these discrepancies:
Now we should see these missing districts are now showing on the map.
At the moment we are colouring each region by a property in the geo data file. Now we have joined the data we can colour by a field in our data. Open the Geo file layer options and scroll down to the "Area colour" section. Click on the button next to the property name and select "Field in report data". Now select "Number of casualties" (a "sum" measure, by default).
Here we can see each district coloured by the total number of accident casualties. We can see, for example, Birmingham has the highest number of casualties.
Now lets show the Point layer by clicking the visibility toggle button. We can see the accident location Points overlaid on top of our GeoFile district areas.
Lets put all this together to create our final dashboard.
Add a "Filters" view and select the "Local Authority" and "Accident severity" and fields. In the Local Authority filter open the options and select "Choices", "Single selection" and Dropdown". In the Accident severity filter options select "Choices".
Select the "Fit to filtered" zoom mode in the Map, and we've finished our dashboard! Users can now select a local authority to view the accidents in that district. They also have the ability to filter by accident severity.
You can try out this dashboard for yourself by clicking on the link here.
Of course this is a very simple dashboard. With a dataset as rich as this the possibilities are endless!
Feel free to let us know what you think about the Map view. Get in touch if you have any questions or feedback, at email@example.com.