Operation

Binning

Generates rectangular or hexagonal bins for a point dataset. This is a way to aggregate point data so that an overview of the data can be displayed efficiently.

Returns the following columns:

  • <dataset key column> - the key column from the input dataset
  • BinId - identity for the bin
  • BinTable.BinPolygon - the polygon for the bin
  • BinTable.CenterPoint - point in center of the bin
  • All columns except the key column from dataset, prefixed with the dataset name.

Supports:

  • ScriptEval in load scripts

Example that loads hexagonal bins from US airports:

Load * Extension GeoOperations.ScriptEval(' Binning(type="hexagonal", gridSize="1") DATASOURCE airports LOCATIONSERVICE geometry="POINT", type="AirportIATA", country="us" ');
ParameterTypeUseDescription
typestringdefault:rectangular Defines if rectangular or hexagonal bins should be generated.
gridSizereal The height of an individual bin in degrees. One degree is approximately 10000 m.
gridWidthHeightRatiorealdefault:1.5 The width height ratio of bins. Optimal is often square bins but that varies by latitude. The formula for the optimal width height ratio is 1/cos(latitude), for example 1 at the equator, 1.15 at latitude +-30 deg and 2 at latitude +-60 deg. It often looks better to display binned data in the adaptive projection than in the Mercator projection.
datasetDataset The dataset with point geometries to generate bins for. Supports streaming of this dataset when sent from the load script which means that larger tables are allowed.

Closest

Returns relations and distances between objects in one dataset and the closest n objects in another, if any is closer than the maximum distance. The cost may also be calculated along roads and in that case optionally use travel time. This operation is useful in many cases, not only for getting the relations to the closest but also for getting distance matrices between a set of points.

Returns the following columns:

  • <dataset1 name>_<dataset2 name>_RelationId - a key generated for the relation between the two geometries
  • <dataset1 key column> - the key column from the input dataset1
  • <dataset2 key column> - the key column from the input dataset2
  • Distance - the distance in the unit specified in costUnit
  • Status - the returned status is either "ok" or "failed:" followed by an error message.
  • LowResLine - a low resolution version of the route line, only available for non bird distance types.
  • All columns except the key column from the input dataset1 dataset, prefixed with the dataset name.
  • All columns except the key column from the input dataset2 dataset, prefixed with the dataset name.

Supports:

  • ScriptEval in load scripts

This example finds the closest airports to points in a table:

MyPoints: LOAD * inline " id;point 1;[12,57.7] 2;[12.1,57.7] " (delimiter is ';'); MyClosestAirports: Load * Extension GeoOperations.ScriptEval(' Closest(distance="100000", closestCount="3") DATASOURCE pts INTABLE keyField="id", pointField="point" DATASOURCE airports LOCATIONSERVICE geometry="POINT", type="AirportIATA", country="se" ', MyPoints);
ParameterTypeUseDescription
distancereal Maximum distance in in the unit specified in Cost unit. Items further apart than this are ignored.
costUnitstringdefault:meters Should be one of meters, yards, kilometers, miles, seconds, minutes, hours. Using time units imply that the travel time is used as the cost and length units that the distance is used. The time units are not allowed for Distance type Bird.
distanceTyperealdefault:Bird Decides how distances are measured. The following values are allowed:
  • Bird - measure birds distances between objects
  • Car - measure along roads with car restrictions, only supported for point datasets
  • Bike - measure along roads with bike restrictions, only supported for point datasets
  • Pedestrian - measure along roads with pedestrian restrictions, only supported for point datasets
  • Truck - measure along roads with truck restrictions, only supported for point datasets
closestCountrealdefault:1 Number of objects in the second dataset to associate with an object in the first dataset. A value of 1 means only the closest, 2 means the two closest and so on.
dataset1Datasetdefault:<first dataset> Objects to check for closeness to objects in dataset2 if specified, otherwise to objects in itself. When checking closeness between objects in a single dataset relations are never added from an object to itself. Supports streaming of this dataset when sent from the load script and dataset2 is defined which means that larger tables are allowed.
dataset2Datasetdefault:<second dataset if any> Objects to relate to objects in dataset1

Cluster

Produces clusters from a point dataset based on geographic closeness between points. The cluster generation is controlled by the distance parameter that defines how far away a point may be from the cluster it belongs to. Returns a table with relations between points and clusters. Also returns a joined in table named Clusters with cluster geometries. It contains the fields ClusterID, ClusterCenter (point geometry) and PointCount. The count field contains the number of points in the cluster.

Returns the following columns:

  • <dataset key column> - the key column from the input dataset
  • ClusterID - Id of the cluster the point belongs to
  • Clusters.ClusterPoint - Center point for cluster
  • Clusters.PointCount - Number of original point belonging to the cluster
  • All columns except the key column from the input dataset, prefixed with the dataset name.

Supports:

  • ScriptEval in load scripts

This example clusters airports in the US so that airports closer than 50 km belongs to one cluster:

MyClusteredAirports: Load * Extension GeoOperations.ScriptEval(' Cluster(distance="50000") DATASOURCE airports LOCATIONSERVICE geometry="POINT", type="AirportIATA", country="us" ');
ParameterTypeUseDescription
distancereal The distance between a point and its cluster is not longer than this distance in meters.
datasetDataset A dataset with points to cluster.

Dissolve

Dissolves and simplifies areas to form larger areas based on a mapping between old area identities (or geometries) and new area identities. This is typically used for building custom areas that are build up by smaller well defined areas, such as postal areas or administrative areas.

Returns the following columns:

  • <dissolveField> - the field specified as dissolveField in indata
  • DissolvedPolygon - the geometries of the new dissolved areas

Supports:

  • ScriptEval in load scripts

The geometry dataset is optional. If not provided, geometries are supposed to be available in the dissolve definition dataset.

Note that overlaps of polygons are removed in all resolutions except Source.

This example creates two regions, one consisting of CA and AZ and one consisting of WA and OR:

MySalesRegions: LOAD * inline " Adm1Code;RegionName California;SouthWest Arizona;SouthWest Washington;NorthWest Oregon;NorthWest " (delimiter is ';'); MySalesRegionGeometries: Load * Extension GeoOperations.ScriptEval(' Dissolve(dissolveField="RegionName", areaDatasetKeyField="Name") DATASOURCE states LOCATIONSERVICE type="State", country="us" ', MySalesRegions);
ParameterTypeUseDescription
dissolveFieldstringdefault:<same name as the key field in dissolveDataset> The name of the field with identities of the new areas in dissolveDataset.
resolutionstringdefault:Auto The resulting dataset is simplified and the degree of simplification is controlled by this property. Available values are:
  • auto - The operation calculates a resolution based on the data that often is OK.
  • autolow - A resolution that is lower (half) of the Auto-resolution.
  • autohigh - A resolution that is higher (double) of the Auto-resolution.
  • source - No simplification is performed. Note that if dissolveDataset contains the same old areas twice in two different new areas, source must be used.
areaDatasetKeyFieldstringdefault:<key field in areaDataset> The identities of the original areas in areaDataset. This is only used if areaDataset is specified.
dissolveDatasetDatasetdefault:<first dataset> The definition of which new area each old area belongs to, i.e. a mapping between old area and new area identities. The key field should map to the keys in areaDataset if specified. If no areaDataset is provided, the geometries should be available in this dataset.
areaDatasetDatasetdefault:<second dataset if any> The dataset with area geometries to dissolve. May be none which means the geometries should be available in dissolveDataset. The areaDatasetKeyField in this dataset must be linked to the key field in dissolveDataset.

Intersects

Returns a table that maps between the key in dataset1 and the key in dataset2 for all objects that intersects. If both datasets contain polygons, the relative overlap area compared to the areas in respective dataset are returned.

It is possible to limit the number of intersecting geometries in the second dataset that should be mapped to each geometry in the first dataset by specifying intersectsCount. Then the most intersecting geometries are returned in order. The operation is symmetric if intersectsCount is not specified.

Returns the following columns:

  • <dataset1 name>_<dataset2 name>_RelationId - a key generated for the relation between the two geometries
  • <dataset1 key column> - the key column from the input dataset1
  • <dataset2 key column> - the key column from the input dataset2
  • <dataset1 name>.RelativeOverlap - the overlap compared to the polygon in dataset1, only returned if both datasets contain polygons. There is a performance penalty for requesting this field.
  • <dataset2 name>.RelativeOverlap - the overlap compared to the polygon in dataset2, only returned if both datasets contain polygons. There is a performance penalty for requesting this field.
  • All columns except the key column from the input dataset1 dataset, prefixed with the dataset name.
  • All columns except the key column from the input dataset2 dataset, prefixed with the dataset name.

Supports:

  • ScriptEval in load scripts

This example calculates which states some lines intersects:

MyLines: LOAD * inline " id;line 1;[[-108.1,45.4],[-107.4,44.9]] 2;[[-98.9,40.1],[-100.4,40.9]] " (delimiter is ';'); LinesInStates: Load * Extension GeoOperations.ScriptEval(' SELECT id, states.Name FROM Intersects() DATASOURCE states LOCATIONSERVICE geometry="AREA", type="Admin1", country="us" ', MyLines);
ParameterTypeUseDescription
dataset1Datasetdefault:<first dataset> A dataset with geometries to test for which intersects the geometries in the other dataset if specified, otherwise between objects in this dataset. When checking intersection between objects in a single dataset relations are never added from an object to itself. Supports streaming of this dataset when sent from the load script and when dataset2 is defined, which means that larger tables are allowed.
dataset2Datasetdefault:<second dataset if any> A dataset with geometries to test for which intersects the geometries in the other dataset. If not specified, intersection between objects in dataset1 is calculated.
intersectsCountintegerdefault:0 If larger than 0 then only at most this number of intersecting geometries in dataset2 is returned per dataset1 geometry. Only the ones that intersects the most (largest overlapping area or length) are returned.

IpLookup

Returns location information and point geometries for IP-addresses in a table. This is useful when you are analyzing access data to web services. The returned table contains the following fields:
  • Key field - same as the key field for the name table
  • <Address Table Ip Field> - same as the ip field that was looked up, only available if not same as key field
  • IpPoint - The point for the found item
  • CountryIso2 - The country code for the found item
  • Adm1Code - The code for the first order administrative area for the found item. Note that this code is not always compatible with the code returned by the location service.
  • City - The city for the found item
  • All columns except the key column from the input dataset, prefixed with the dataset name.

IP geolocation is inherently imprecise. For many IP-addresses it is possible to pinpoint a city but for others only country can be resolved.

Best practise is to only send the Ip-column to the IpLookup operation. Example that looks up some IP addresses:

MyIpData: LOAD * inline " User;Ip Bert;188.12.2.2 Ernie;176.77.23.14 " (delimiter is ';'); MyIpPoints: Load * Extension GeoOperations.ScriptEval(' IpLookup(ipField="Ip") ', MyIpData{Ip});

It is common that the same IP is repeated in many rows. It then improves performance to first filter out only the unique IPs like in this example:

MyIpData: LOAD * inline " User;Ip Ernie;176.77.23.14 Bert;188.12.2.2 Bernie;176.77.23.14 Piggy;188.12.2.2 Bert;188.12.2.2 Bert;188.12.2.2 " (delimiter is ';'); MyDistinctIpData: Load distinct Ip resident MyIpData; MyIpPoints: Load * Extension GeoOperations.ScriptEval(' IpLookup(ipField="Ip") ', MyDistinctIpData); Drop Table MyDistinctIpData;

This product includes GeoLite2 data created by MaxMind, available from http://www.maxmind.com.

ParameterTypeUseDescription
ipFieldstring optional The field with the IP-address to look up. Uses the key field of the dataset if not specified.
datasetDataset A dataset with IP-addresses that will be looked up in the geocoder. Supports streaming of this dataset when sent from the load script which means that larger tables are allowed.

Load

Just loads the dataset, no operation applied. This makes it possible to load all the formats that GeoOperations supports. Note that Simplify can be a good alternative to Load if geometries are detailed and slow to display.

Returns the following columns:

  • All columns from dataset.

Supports:

  • ScriptEval in load scripts

Example that loads postal codes from Sweden:

Load * Extension GeoOperations.ScriptEval('Load() DATASOURCE PostalCodes LOCATIONSERVICE type="PostalCode", country="se"');

Since WKT is supported as geometry format for data in INTABLE, the Load operation is excellent for converting geographic geometries loaded from a database into the Sense geometry format so that it can be displayed. The following example shows how to convert WKT data, in this case from the MyWKTData table:

MyWKTData: LOAD *inline " id;wkt 1;POINT(-80.204 25.791) 2;POINT(-81.381 28.538)" (delimiter is ';'); Load * Extension GeoOperations.ScriptEval(' Select id, wkt as point From Load() ', MyWKTData);
ParameterTypeUseDescription
datasetDatasetdefault:<first dataset> Dataset to load. Supports streaming of this dataset when sent from the load script which means that larger tables are allowed.

Routes

Calculates routes, including length and duration, between two locations in a table.

Note that the origin is the geometry column in the dataset. The destination column is specified in operation parameters since datasets only know of one geometry column.

If you use bird as transportation type it generates great circle arcs between origins and destinations.

Returns the following columns:

  • <dataset key column> - the key column from the input dataset
  • Distance - the route distance in meters
  • Duration - the estimated route travel time in seconds
  • Status - the returned status is either "ok" or "failed:" followed by an error message.
  • LowResLine - a low resolution version of the route line
  • All columns except the key column from the input dataset, prefixed with the dataset name.

Supports:

  • ScriptEval in load scripts
  • ScriptEvalStr in chart scripts for getting the route
  • ScriptEval in chart scripts for getting the distance or duration

This is an example that calculates routes between points in a dataset:

MyRoutePoints: LOAD * inline " routeid;origin;dest 1;[12,57.7];[12,57.8] 2;[12.1,57.7];[12.2,57.7] " (delimiter is ';'); MyRoutes: Load * Extension GeoOperations.ScriptEval('Routes(destField="dest")', MyRoutePoints);

This is an example that calculates routes directly in a Line Layer. The operation is called for the selection every time the selection changes. Normally there should be a calculation condition that is true if only a few points are selected (otherwise it is better to calculate the routes in the load script). This should be put in the load script to load the data for the example:

Load * Extension GeoOperations.ScriptEval( 'Load() DATASOURCE Cities LOCATIONSERVICE geometry="POINT", type="City", country="dk"');

Use the following dimension in the Line Layer:

LocationDbId

Use a calculation condition in the Line Layer:

Count(LocationDbId)<10

In the Location property, which should be set to Line geometry, put this to calculate the routes from a fixed position to the selected points:

=GeoOperations.ScriptEvalStr('SELECT LowResLine from Routes(originField="Me", destField="LocationPoint")', '[11.2,54.8]' as Me, LocationPoint)

ParameterTypeUseDescription
datasetDataset A dataset with origins and destinations for the routes to calculate. The origins should be in the geometry of the dataset. Supports streaming of this dataset when sent from the load script which means that larger tables are allowed.
criteriastringdefault:fastest Chose between fastest or shortest route to be calculated.
transportationstringdefault:car The transportation mode, one of car, truck, bike, pedestrian or bird (which flies at 10m/s).
destFieldstring The field in the dataset that specifies the destination. Note that the origin is the geometry field specified in the dataset.
geometryTypestringdefault:POINT Type of geometry in destField. Allowed values are Point, NamedPoint and LatLon. In case of named points, the geometry is looked up in the location service and a column for the geometry is added.
suffixstring For advanced users. The specified string is appended to all IDs. This is a convenient way to specify more information to server based location services such as country code or type. The alternative is to append the extra data when loading the table into Qlik. With the following suffix all items are specified to be cities in Sweden:
,SE:city
See the Location Service Guide for more information on syntax to use.

Simplify

Simplifies line and area geometries in a dataset. It is often a useful to load geographic data with the Simplify operation instead of the Load operation to get more efficient geometries that are faster to display.

The degree of simplification is calculated automatically based on area, number of objects and size of objects. It is then possible to adjust that to a higher or lower resolution with the resolution parameter.

Area simplification is done with an algorithm that handles topologies and can remove gaps and join islands.

Line simplification is done with a breakpoint reduction algorithm.

Note that overlaps of polygons are removed. There will be no overlapping polygons in the output.

Returns the following columns:

  • <dataset key column> - the key column from the input dataset1
  • Simplified_<geometry column name> - simplified versions of the original geometries
  • All columns except the key column from dataset, prefixed with the dataset name.

Supports:

  • ScriptEval in load scripts

Example that loads simplified versions of US states:

Load * Extension GeoOperations.ScriptEval(' SELECT LocationDbId, Simplified_LocationPolygon FROM Simplify() DATASOURCE states LOCATIONSERVICE type="State", country="us" ');
ParameterTypeUseDescription
resolutionstringdefault:Auto The resulting dataset is simplified and the degree of simplification is controlled by this property. Available values are:
  • Auto - The operation calculates a resolution based on the data that often is OK.
  • AutoLow - A resolution that is lower (half) of the Auto-resolution.
  • AutoHigh - A resolution that is higher (double) of the Auto-resolution.
datasetDatasetdefault:<first dataset> The dataset with geometries to simplify.

TravelAreas

Calculates travel time iso areas. All locations within the returned area can be reached within a certain time or is closer than a certain distance along roads. Returns a table with id, travel area geometry, center point, cost, cost unit and status (OK or failed).

If you use "bird" as transportation type it generates geographically correct circles around the origins.

Returns the following columns:

  • <dataset key column> - the key column from the input dataset
  • TravelArea - the polygon geometry that defines the travel area
  • Cost - the cost as specified in the costValue or costField
  • CostUnit - the cost unit as specified in costUnit
  • Status - the returned status is either "ok" or "failed:" followed by an error message.
  • All columns except the key column from the input dataset, prefixed with the dataset name.

Supports:

  • ScriptEval in load scripts
  • ScriptEvalStr in chart scripts for getting the travel area geometry
  • ScriptEval in chart scripts for getting cost

This load script example generate 10 minute travel areas in Miami and Orlando from coordinates:

MyPoints: LOAD * inline " id;point 1;[-80.204,25.791] 2;[-81.381,28.538] " (delimiter is ';'); MyTravelAreas: Load * Extension GeoOperations.ScriptEval( 'SELECT id, TravelArea from TravelAreas(costValue="10", costUnit="Minutes")', MyPoints);

This load script example generate 10 minute travel areas in Miami and Orlando using named points:

MyCities: LOAD * inline " cid;City 1;Miami,US 2;Orlando,FL,US " (delimiter is ';'); Load * Extension GeoOperations.ScriptEval('TravelAreas(costValue="10",costUnit="minutes") DATASOURCE cities INTABLE keyField="City", namedPointField="City"', MyCities {City});

This is an example that calculates Travel Areas around points directly in an Area Layer. The operation is called for the selection every time the selection changes. This should be put in the load script to load the data for the example:

MyAirports: Load * Extension GeoOperations.ScriptEval(' Load() DATASOURCE airports LOCATIONSERVICE geometry="POINT", type="AirportIATA", country="se" ');

Use the following dimension in the Area Layer:

LocationDbId

Use a calculation condition in the Area Layer:

Count(LocationDbId)<10

In the Location property put this:

=GeoOperations.ScriptEvalStr('Select TravelArea from TravelAreas(costValue="10", costUnit="minutes")', LocationPoint)

ParameterTypeUseDescription
datasetDatasetdefault:<first dataset> A dataset with origins and optionally costs for the travel area calculations. Supports streaming of this dataset when sent from the load script which means that larger tables are allowed.
costValuenumberdefault: The cost at the border of the returned area. The cost can be either a length or a time, see cost unit below. An alternative that allows individual costs for each area is to specify costField instead.
costFieldstringdefault: A field in the dataset that specifies the cost. This is only used if costValue is empty.
costUnitstringdefault:seconds Should be one of seconds, minutes, hours, meters, yards, kilometers, miles. When a time unit is used, the area reached within that time is calculated and when a length unit is used, the area with a travel distance shorter than specified is calculated.
transportationstringdefault:car The transportation mode, one of car, truck, bike, pedestrian or bird (which flies at 10m/s).

Within

Returns the relations between two datasets where a geometry in one dataset (enclosed) is completely inside the area in the other dataset (enclosing). Returns a table which maps between the key in enclosed and the key in enclosing for all found relations.

Use within typically for finding which areas the data is in. For example to test GPS-position for which administrative area they are in. This is a kind of reverse geocoding.

Returns the following columns:

  • <enclosed name>_<enclosing name>_RelationId - a key generated for the relation between the two geometries
  • <enclosed key column> - the key column from the input dataset1
  • <enclosing key column> - the key column from the input dataset2
  • All columns except the key column from the enclosed dataset, prefixed with the dataset name.
  • All columns except the key column from the enclosing dataset, prefixed with the dataset name.

Supports:

  • ScriptEval in load scripts

To compensate for inaccuracies in data it is sometimes better to use Closest instead of Within. For instance if you have point data in costal areas which you want to relate to administrative areas, small inaccuracies can make points fall slightly outside of the areas.

This is a load script example that calculates which points are within which states:

MyPoints: LOAD * inline " id;point 1;[-108.1,45.4] 2;[-98.9,40.1] 3;[12.1,57.7] " (delimiter is ';'); PointsInStates: Load * Extension GeoOperations.ScriptEval(' Within() DATASOURCE states LOCATIONSERVICE geometry="AREA", type="Admin1", country="us" ', MyPoints);
ParameterTypeUseDescription
enclosedDatasetdefault:<first dataset> A dataset with geometries to test for which areas they are enclosed by. Supports streaming of this dataset when sent from the load script which means that larger tables are allowed.
enclosingDatasetdefault:<second dataset> A dataset with area geometries to test for which geometries they enclose. Supports streaming of this dataset when sent from the load script which means that larger tables are allowed.

Did this information help you?

Thanks for letting us know. Is there anything you'd like to tell us about this topic?

Can you tell us why it did not help you and how we can improve it?