Today’s ‘Just Qlik it’ focuses on using simple maps in QlikView. I’ve been playing with this kind of objects in Qlik Sense recently and I thought it would be good to remember how we created these cartographic visualizations in the old days.
As the ancient masters taught us, before Qlik Sense, GeoQlik and custom extensions, there were scatter charts…
An easy way to create maps in your applications is to exploit the Google API. As always, the reference material with all the examples is here.
1.- Paste the ‘Google Maps’ tab in your script
2.- Be sure to create the fields for Longitude and Latitude in your data model. If you don’t have this information, you can manually find it online (hahaha) or you can search it within your QV script with a routine like this one:
You can use data that is already in your catalogues like the city or zip code to ask Google for a XML file with the fields you need. In this example, I am only using the zip code and the string ‘MX’ (I am from Mexico), but you can concatenate multiple fields to be more specific.
Just a warning, Google has a limit of free daily queries, so you might want to create a QVD that stores this information and only ask for the new zip codes with an incremental load.
3.- Select which type of map you want and customize it.
Bubble Size Map
Dimension: Select the appropriate field (country, city, store, etc.)
Expression 1 (Longitude): It’s not necessary to edit the expression itself. However, the color is defined in the ‘Background Color’ option.
Expression 2 (Latitude): No customization needed.
Expression 3: Add your expression here.
Expression 4: If you want, you can create a customized pop-up with more information.
Color Intensity Map
The trick behind this map is to change the bubble size (Expression 3) to 1 and set the color (Expression 1 > Background color) with a Color Mix function:
Bubble size + Color Map
Assign an interesting conditional function to the color. Seems pretty simple, but you can create awesome maps if you represent one metric with the bubble size and another one with the color intensity. For example, a big bubble could represent a strong territory (high sales), but an intense bubble could be considered an intelligent territory (high margin). The interaction between these two perspectives in your brain can bring interesting results.
Update: Recently, Google changed the URL of the images we use as backgrounds for this kind of maps, so you’ll have to make some minor adjustments in your apps.
Forget about bubbles and let Google do the work. You can create a text object (Representation: Image) with this formula:
The only tricky thing is that you need an ISO 3166 code in your data model, but you can get it for Wikipedia.
Of course, there are many other interesting options out there, but it is good to return to the classics every now and then.
Any suggestions or ideas? Leave a comment in the section below!