Qlik Sense GeoOperations

Qlik Sense GeoOperations enable geographic calculations and functions such as calculating routes or travel areas. It also enabled loading geographic data from GeoJSON and ESRI shapefiles.

Qlik Sense GeoOperations is available as an Advanced Analytics Integration with Qlik Sense GeoAnalytics for Qlik Cloud Services and Qlik Sense Enterprise on Kubernetes. Qlik Sense GeoOperations requires an add-on to the license that you can either include when purchasing the license, or that you can add later.

Qlik SenseGeoOperations enables you to solve geographic problems with your data, such as:

  • Determining how many customers are living within a 15 minute drive from a store location
  • Linking GPS positions to venues, regions, or road networks
  • Building custom sales areas from a list of municipalities
  • Finding the closest hospital for a list of patients

GeoOperations functions are available in scripting for both the data load script and in visualization expressions. GeoOperations functions provide access to loading geographic datasets from external files or from the Qlik GeoAnalytics location service. GeoOperations functions also can be used to transform geographic data or make calculations.

How GeoOperations works

Qlik Sense GeoOperations works by sending small pieces of script and optionally a table to the GeoOperations extension in the load script. The extension then returns the data. GeoOperations makes an Advanced Analytics Integration object called GeoOperations available in the script language that provides the function ScriptEval for sending the script and the table to the extension. For example, the following is the load script for load script for applying the TravelAreas operation to the previously loaded table MyPoints and specify parameters for the size/cost of the travel area:

Load * Extension GeoOperations.ScriptEval('TravelAreas(costValue="10", costUnit="Minutes")', MyPoints);

 

The script is sent as the first parameter to ScriptEval and the table as the second.

The GeoOperations are functions that operates on datasets. The datasets either come from data loaded in Qlik Sense or from external sources such as geographic files or the location service. The data sent out from the script is available as a dataset named INTABLE. If you want to specify additional parameters on that data, you need to declare it after the function call as a DATASOURCE. For example:

Load * Extension GeoOperations.ScriptEval('TravelAreas(costValue="10", costUnit="Minutes")

DATASOURCE myPoints INTABLE pointField="Point"', MyPoints);

 

Other types of data sources always need to be declared and parameters such as URLs need to be specified. In each operation you can specify the data sources to use. By default, operations use it picks up the available datasets.

Where to use GeoOperations

All operations can be used in the data load script. Certain operations can be used in chart scripts for maps to as well to enable dynamic calculations. Each time the selection changes, the operation is run. Data does not go into the data model when GeoOperations are used in charts, preventing further analysis of that data.

Selecting and renaming GeoOperations fields

GeoOperations functions return fields. By default, all fields are returned and included. You can precede GeoOperations functions with a SELECT statement to both select and optionally rename specific fields in which you are interested. For example, this script uses SELECT to load only two of the postal code fields from the location service:

Load * Extension GeoOperations.ScriptEval('

SELECT Name as PostalCode, LocationArea FROM

Load() DATASOURCE PostalCodes LOCATIONSERVICE type="PostalCode", country="se"');

 

Using a SELECT statement in the GeoOperations script can be more efficient than specifying fields in Qlik LOAD statement as the data is not loaded into Qlik Sense if it is not selected in the GeoOperations script.

SELECT can be used to avoid calculating some fields by choosing not to return them in the results. For example, the relative overlap fields returned by Intersects can be excluded.

Note:

If you are using the same operation multiple times in your load script, use a SELECT statement to rename the fields.

Limitations

The following limitations apply to the maximum size of datasets:

  • Max number of rows: 50000
  • Max dataset size in memory: 150MB
  • Max rows with routing: 400
  • Max rows with name lookups: 20000

Some operations support streaming data from Qlik Engine. Data streamed from Qlik Engine can be larger but the size limit for routing still applies.

Script syntax

The script that can be sent to GeoOperations has the following syntax.

Syntax:  

script ::= [ SELECT (* | select_field,...) FROM ] operation ( [parameter,...] ) {datasource_declaration}

select_field ::= field_name [ AS alias_name ]

parameter ::= parameter_name = "parameter_value"

datasource_declaration ::= DATASOURCE datasource_name datasource_type [parameter,...]

  • field_name - a name of a field in the returned table, optionally enclosed in []
  • alias_name - a name that a field should be renamed to, optionally enclosed in []
  • operation - one of the operations in Operation
  • parameter_name - name of the parameter for the operation
  • parameter_value - the value of the parameter (always enclosed in double quotes)
  • datasource_name - the name that this data source should have if referenced in the operation parameters
  • datasource_type - one of the datasets in Dataset

Parameter names and field names are case sensitive but operations, parameter options (like meters, minutes, car, etc) or keywords such as SELECT and FROM are not.