Geospatial functions are for handling data when using map visualisations. They apply to geospatial data. Some of the functions are aggregating functions. These functions are useful if your business utilises geographical data which you want to use for reporting purposes using map visualisations.

This article will cover the basic principles of working with geospatial functions in the data load editor and visualisations, including:

  • The general function syntax
  • Working with geospatial functions in the data load editor
  • Working with geospatial functions in charts

For a complete, up-to-date list of geospatial functions, please see the Qlik Sense help pages here.

The geospatial function syntax

The syntax will differ depending on the function. For up-to-date syntax, please do refer to the Qlik help pages here.

Understanding the function syntax given by Qlik Sense

It isn’t easy to decipher the syntax provided in the help pages linked to above if you aren’t used to reading it. In this section, we will explain how to read this syntax so that you can apply this thinking to every function in the help pages.

To explain the syntax, we will use an example function.

Example 1: GeoMakePoint

This function returns tag points given the longitude and latitude given.

GeoMakePoint(lat_field_name, lon_field_name)

The rules for reading this are as follows:

  1. The function name itself is first and all the parameters you need to enter go between brackets: ().
  2. The various elements you will need to enter are separated by commas. In this function, there are 2 elements: lat_field_name and lon_field_name.
  3. Anything between square brackets [] is an optional parameter. In this function, there aren’t any optional parameters.

An example of this function being used could be:

GeoMakePoint(51.5014741695269,-0.14186854495324716)

The above function will return the tag point for the given latitude and longitude, which according to Google Maps is the Buckingham Palace in London.

How to use geospatial functions in the data load editor

Now that you understand how to read the syntax of Qlik functions, you need to understand how to use these functions in the load. The rules are:

  • Some of the functions are aggregation functions which means you must use the ‘group by’ clause within the LOAD or SELECT statement
  • The functions that are not aggregation functions, must not be used with a ‘group by’ as this will cause an error

How to use geospatial functions in charts

The syntax to use geospatial functions in visualisations is the same. The general rules are:

  • Some of the functions are aggregation functions, which means you must use them as a measure unless you use the Aggr() function. See more on the Aggr() function here.
  • The functions that are not aggregation functions can be used as any, a dimension or a measure.