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:
Countries:
LOAD
Country,
Round(Rand()*1000, 1) as Value
INLINE [
Country
United Kingdom
Japan
Mexico
Egypt
];
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.
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.
This post is lifted directly from the manual provided to delegates on our Qlik Sense Training courses. A twelve page sample PDF of this material is available here.
Thanks Steve. Using June 19. It took me less than minute to build this app.
Nice one! Thanks for sharing Muhammad. The maps feature is a nice one to demo with Sense.
Is it also possible to have multiple countries get shown together? For example i want Belgium and Luxembourg to be shown together on the map in stead of separately.
Yes, but you would lose the ability to use the simple country lookup and automap feature. If you could find a KML file where the two countries are joined then you could in theory use that. A simpler way though would be to go to a point based map instead. You can find lots of data sources online that give country codes and locations. You would need to add a row to the end of one of these (probably with an INLINE load) for the combined Belgium and Luxembourg. You would also have to swap out the country name or code with the revised one, e.g.
replace(replace(Country, ‘Belgium’, ‘Belgium/Luxembourg’), ‘Luxembourg’, ‘Belgium/Luxembourg’) as Country,
Not too difficult, but not quite as easy as having Sense draw the map for you automatically.