The ability to quickly build interactive maps, even without having lat/long data is a key strength of Qlik Sense. This chapter from our Sense Training Course material describes the steps required to create a map in just a few simple steps.
9.1 Introduction to Mapping in Qlik Sense
Soon after Qlik Sense was first released, Qlik acquired a company called Idevio who had a product called GeoAnalytics. This product was a third-party extension for QlikView and Sense which allowed the plotting of data on a map and advanced GeoCoding solutions. The map visualisation part of GeoAanlytics was brought into in every different flavour of Sense (even the free versions) and is one of the areas that sees new features at just about every release. The advanced GeoCoding elements (such as looking up the location of an address in a load script) require a separate licence, but for most use cases are not required.
The AI built into Sense looks out for potential geographical data and will suggest maps as the default visualisation when it feels the data is of the correct type. This includes simple GeoCoding of Country names, looking up the shape of countries to plot on a map.
As an aside to our MOT application, go to the Hub from the main menu and create a new application called Simple Maps (refer back to section 2.4 if you need a reminder on how to do this). Open the Load Script Editor and enter the following script:
Round(Rand()*1000, 1) as Value
function in this load auto-creates a number between 0 and 1. Multiplying it by a thousand therefore gives a number between 0 and 1,000. The Round()
function simply makes that number an integer.Feel free to add more countries if you wish. When done click Load Data
, then Close
(if required) and finally click the Analysis
button at the top of the screen.
You should be presented with a blank page. Click the Edit button and expand Fields. Drag the Country field into the top left quadrant of the page. The cognitive engine should then do its thing and decide it should show these data as a map.
So far this just shows us that Sense knows where our countries are. Typically, we will also have values we want to encode in the chart.
Before we do this, turn off Chart Suggestions from the top of the Properties pane on the right-hand side.
Now that Sense isn’t going to try and change our map to something different, drag the Value field onto the map.
As with other chart types, you will be prompted for how Sense should treat this value.Navigate through the menu options;
Use In ‘Country’ (Area Layer) / Colour By / By Measure / Sum(Value)
Once these steps are completed each of the countries will be coloured and a chromatic scale will be added to the side of the map.
With the random numbers as they were at the time I reloaded my app you can see that Japan has the highest value at 881, Egypt the lowest at 271 (the extremes of the scale) and the UK and Mexico fall between these.
Note that the map is interactive, with pop-ups as you hover over Countries and the ability to make selections by clicking. You can also lasso, in the same way as you do on a Scatter Chart.
There are many other options in the map properties, some of which we will explore later in this chapter. For now though you can close this application and return to your MOT application.