September 25, 2024 By Oli Reynolds

Geospatial data visualisation: a Qlik Sense and KML tutorial

Share:

Understanding KML

KML, or Keyhole Markup Language, is an XML-based format used to express geographic annotation and visualisation. It's designed for use with two-dimensional maps and three-dimensional Earth browsers.

As an open standard maintained by the Open Geospatial Consortium (OGC), KML is widely supported across various platforms, making it ideal for sharing and visualising geospatial data.

 


Creating KML files for Qlik Sense

KML Structure Basics

A KML file consists of features primarily represented by placemarks (points), polygons (areas), or lines. These features are organised hierarchically, allowing for complex geographic information representation.

Creating the KML file 

  1. Open Google Earth and use the search bar to find your desired location. ("Willen Lake, Milton Keynes" for example.)
  2. Click the "+ New" button in the top left corner to create a new project. For simplicity, create a "Local KML file" rather than importing from Google Drive. This will appear in the "Local KML files" section on the left panel.
  3. To create an area polygon, select the polygon tool (icon with connected dots) from the toolbar. Begin clicking points on the map to outline your desired area. The image shows a yellow dotted line being drawn around a lake.
  4. After completing your polygon, a dialog box will appear with details about the area. Save the polygon to your project and rename it (e.g., "Lake 1"). The map view now shows the outlined lakes.
  5. To add a label point, select the placemark (pin) icon from the toolbar. Click on the map where you want to place the point. Name this point to match its corresponding polygon (e.g., "Lake 1") for easier linking in other software.

Oli blog


Repeat steps 3-5 for additional areas or points as needed. The left panel will show your saved items under your project name.


Remember, you can turn off "3D Buildings" in the layers option if they obstruct your view while drawing. This process allows you to create both area polygons and point markers for further use in other applications.

 


Exporting the KML file 

This step is nice and straightforward, simply hover over the project title, select the 3 dots that appear to show the settings and select ‘Export as KML file’.  

Oli blog (1)

 


Importing KML into Qlik 

Bringing your KML data into QlikSense is a straightforward process:

  1. Add your KML file to QlikSense:
    Simply drag and drop your KML file into your datafiles connection in Qlik SaaS. QlikSense is designed to recognise and read KML files directly through its data editor.

  2. Preview and analyse the data:
    Once imported, QlikSense's data selection wizard will automatically preview the data for you. It will prefix the KML fields with the filename for easy identification. In our example, you'll notice we have 4 rows, each containing a point value and an area value for each 'name'. This structure reflects how we named the point and area values identically in Google Earth during creation.

    Tip: If you hadn't completed and closed the area polygon in Google Earth, it would have been saved as a line, which can also be loaded into QlikSense.

  3. Load the data using an appropriate script
    To properly import the KML data, you'll need to use a specific loading script. Here's an example of the script used to load our KML data:

    Willen:
    LOAD
        WillenLakeDemo.Name as Name,
        WillenLakeDemo.Point as Point,
        WillenLakeDemo.Area as Area
    FROM [lib://DataFiles/WillenLakeDemo.kml]
    (kml, Table is [Willen Lake]);

    This script loads the Name, Point, and Area fields from our KML file, renaming them as needed.

  4. Examine the imported data
    After loading, you can view the data in a table in QlikSense. You'll notice that the Point field consists of a single longitude and latitude pair, while the Area field is made up of a series of longitude and latitude pairs. This structure allows QlikSense to properly render both point markers and area polygons on your maps.

Picture11

 


Using the KML in Qlik 

Qlik's intuitive interface makes working with KML data straightforward:

Recognising geographical data:
Qlik automatically identifies geographical data, indicated by a globe symbol next to field names in the field selector.

Picture12


Creating basic maps:
Simply drag the geographical field onto a sheet. Qlik will automatically create a map chart with an area layer using the area data.

Picture13

Adding point data:
To incorporate point data:

  1. Disable 'chart suggestions' in the properties panel
  2. Create a new 'point layer'
  3. Use 'Name' as the dimension and set 'Point' as the location field

Picture14


The result is a map displaying both area and point data, demonstrating the versatility of KML elements created in Google Earth.

Picture16


Advanced visualisation example:
To showcase more complex applications, we've created a mock mining data visualisation:

  • The lake is divided into grid sections, each with a point reference
  • Polygon grids in the area layer illustrate locations and enable area selections
  • Points in a density layer create heatmaps showing material concentration


Oli blog (3)

 

 


Summary

This blog has explored the integration of KML with QlikSense, showing you how to enhance your geospatial data analysis. Some of the key takeaways are:

  • Versatile applications: From sales territories to urban planning, KML and QlikSense work across various fields.
  • Data transformation: Convert complex geographical information into clear, actionable insights.
  • Pattern recognition: Identify trends and opportunities hidden in your spatial data.
  • Informed decision-making: Leverage geographical insights for better strategic planning.
  • User-friendly tools: Easily create dynamic, interactive maps with your data.

Ready to see how KML and QlikSense can transform your data analysis? Get in touch to explore the possibilities for your organisation:

Speak to an expert

 

Comments

About Author

Oli Reynolds

Oli is one of our senior Qlik consultants and has many years’ experience working with the software. He specialises in Qlik Sense app development and enjoys using Qlik’s GeoAnalytic toolkit. He’s also a passionate football fan – ask him about his Fantasy Football Qlik Sense app!

Related Posts

Geospatial data visualisation: a Qlik...

Learn how to integrate KML with QlikSense for enhanced geospatial data analysis and create interactive maps for better strategic planning. === Main Point Summary: The blog provides a tutorial on...
Go to Post

Be the first to hear about new events and updates