The purpose of this app is to show an example of how to integrate and display different layers of geographical boundaries available for the UK.
The data displayed has been randomly generated just to show the potentials of this implementation.
There are multiple geographical levels in the UK and KML maps are freely available for download; a drill-down path can be established between the different layers:
European Electoral Regions (EERCode) > Local authority district (DistrictCode) > Middle layer super output areas (MSOACode) > Lower layer super output areas (LSOACode) > Output areas (OACode)
The link between the different layers is provided by the postcode database that lists all the available postcodes in the UK and their relations to all the relevant layers; multiple areas can be selected at the same time.
This applications has two sets of inputs:
Boundaries KML files:
The KML files are read during data load as XML, and reformatted to then be read by the maps area layer in the Qlik Sense app. They can't be read straight as KML files as the name of each area needs to be extracted from a property field in the source files. As the boundary maps are updated, from time to time the name of these key fields changes. I've defined these key fields in 5 separate variables in the "Main" tab in the data load editor; just ensure that these names have the correct correspondence in KML files if you decide to download updated maps in the future.
The drill down feature relies on dimensions to be calculated by an expression. I've noticed that Qlik Sense tends to modify this expression if I open and close the editor. This is how it should look like in the "Map object > Area layer > Data >Dimensions > Area > Field": '$(dimensionUse2)' [note that single quotes are required]. If you open the expression editor Qlik Sense will add an extra "=" sign and extra square brackets which will break the expression; just remove the "=" sign and the square brackets without opening the expression editor.
Postcode file and maps are all loaded in memory; to limit the size of the database I've loaded low resolution maps; you can find higher resolution maps from the links above. For the type of analysis I work on (statistical analysis on house pricing, crime and population with R) I don't see the need for the higher resolution maps.
I've also included a "Zoom Out" button which allows to drill up to next higher map level; ensure you have the Qlik dashboard bundle installed. I've used Qlik Sense September 2019 version to develop this app.
You can also establish a different path for drill down to limit the number of layers or to have a different starting layer; just have a look how dimensions are dynamically defined in the variables section.
I've included all the files in the zip folder; ensure the Data connection in the data load editor points to the correct folder on your machine.
I hope this is helpful; please get in touch if you have any questions.
Lorenzo