# Documents

Qlik Sense documentation and resources.

Announcements
QlikWorld Online 2021, May 10-12: Our Free, Virtual, Global Event REGISTER TODAY

# GeoAnalytics for QV tutorial, TravelAreas, Closest, Dissolve

Employee

## GeoAnalytics for QV tutorial, TravelAreas, Closest, Dissolve

This guide has been used for customers that have had an interest in getting to learn Qlik GeoAnalytics for QlikView. It is a step by step guide introducing the layer concept and also introducing the GeoAnalytics Connector by using it in some real examples.

Table of Content

1. Introduction

2. Exercise 1

Create a new QlikView app

Start using the GeoAnalytics Extensions

Map-, Bubble- and Area-layer

3. Exercise 2

- QGA Connector operation “Closest

- Add a Map-, Line and two Bubble-layers

- Add Travel Areas with the QGA Connector

4. Dissolve countries into continents

- Use the Dissolve Operation

- Create a Drill-down

Material includes:

• QGAGettingStartedGuide.pdf
• Data for the exercises
countryxcontinent.xlsx
gettingstarteddata.xlsx
USACities.qvd
• 2 applications with the result of the exercises
country_continent.qvw
gettingstarted_Ex1_Ex2.qvw‌
Tags (3)
Labels (2)

• ### Qlik GeoAnalytics

Partner

I am working on a project where I have to find the shortest distance between 2 points.  In the examples that I have seen so far, the "from"  point can be loaded via a QVD, just like in this example, or from an INLINE table.  With the "to" point, the example used in this example are airports which are listed with IATA.  How do I upload data that have the coordinates?  Do I specify this in the dialog box?  I cannot my connector right now because it's down.

Employee

Hi,

The start and end point needs to be in the same table, see below for an example with separate fields for long and lat. The example shows the indata and the parameters for the QGA connector operation "Route".

The geometries can Point, Location Named Point and Latitude and Longitude Point. In case of named points, the geometry is looked up in the location service and a column for the geometry is added.

Note that all fields used must be listed in "Table fields:"

Thanks,

Patric

[points]:

id,s_lo,s_la,e_lo,e_la

1,-81.403809,28.805678,-81.404850,28.802030

];

/*

Operation: Routes

Operation parameters

Criteria: Fastest

Transportation: Car

Destination field: e_la,e_lo

Destination Geometry Type: latitude and longitude Point

Destination Location ID Suffix:

End points

Name: rts

Table Name: points

Table fields: id,s_la,s_lo,e_la,e_lo

Geometry Type: latitude and longitude Point

Location ID Suffix:

CRS: Auto

*/

Employee

As always, thanks for the great up @Patric_Nordstrom  and @Jonas_Linden1 !  I'm working on updating this document for the latest GeoAnalytics Feb 2019  🙂

When I try to build the GeoData layer as in the example it didn't work initially. The problem was that the data in the map was cached. To  refresh the cache and show the weather data you can either hit F5 or turn off WebView and turn it back on.

Partner

Hi guys pardon my ignorance, I am getting the following code using the closest function using Qlik GeoAnalytics plus connector and this code is throwing error upon loading script, could someone help me on this ?

LIB CONNECT TO 'IAG GeoAnalytics Connector';

/* Generated by GeoAnalytics for operation Closest ---------------------- */
[_inlineMap_]:
_char_, _utf_
"'", '\u0027'
'"', '\u0022'
"[", '\u005b'
"/", '\u002f'
"*", '\u002a'
";", '\u003b'
"}", '\u007d'
"{", '\u007b'
"`", '\u0060'
"´", '\u00b4'
" ", '\u0009'
];

IF FieldNumber('name', 'hometable') = 0 THEN
call InvalidInlineData('The field name in hometable is not available');
END IF
IF FieldNumber('lat', 'hometable') = 0 THEN
call InvalidInlineData('The field lat in hometable is not available');
END IF
IF FieldNumber('long', 'hometable') = 0 THEN
call InvalidInlineData('The field long in hometable is not available');
END IF
Let [homeInlineTable] = 'name' & Chr(9) & 'lat' & Chr(9) & 'long';
Let numRows = NoOfRows('hometable');
Let chunkSize = 1000;
Let chunks = numRows/chunkSize;
For n = 0 to chunks
Let chunkText = '';
Let chunk = n*chunkSize;
For i = 0 To chunkSize-1
Let row = '';
Let rowNr = chunk+i;
Exit for when rowNr >= numRows;
For Each f In 'name', 'lat', 'long'
row = row & Chr(9) & MapSubString('_inlineMap_', Peek('\$(f)', \$(rowNr), 'hometable'));
Next
chunkText = chunkText & Chr(10) & Mid('\$(row)', 2);
Next
[homeInlineTable] = [homeInlineTable] & chunkText;
Next
chunkText=''
[_inlineMap_]:
_char_, _utf_
"'", '\u0027'
'"', '\u0022'
"[", '\u005b'
"/", '\u002f'
"*", '\u002a'
";", '\u003b'
"}", '\u007d'
"{", '\u007b'
"`", '\u0060'
"´", '\u00b4'
" ", '\u0009'
];

IF FieldNumber('name', 'hometable') = 0 THEN
call InvalidInlineData('The field name in hometable is not available');
END IF
IF FieldNumber('lat1', 'hometable') = 0 THEN
call InvalidInlineData('The field lat1 in hometable is not available');
END IF
IF FieldNumber('long1', 'hometable') = 0 THEN
call InvalidInlineData('The field long1 in hometable is not available');
END IF
Let [home1InlineTable] = 'name' & Chr(9) & 'lat1' & Chr(9) & 'long1';
Let numRows = NoOfRows('hometable');
Let chunkSize = 1000;
Let chunks = numRows/chunkSize;
For n = 0 to chunks
Let chunkText = '';
Let chunk = n*chunkSize;
For i = 0 To chunkSize-1
Let row = '';
Let rowNr = chunk+i;
Exit for when rowNr >= numRows;
For Each f In 'name', 'lat1', 'long1'
row = row & Chr(9) & MapSubString('_inlineMap_', Peek('\$(f)', \$(rowNr), 'hometable'));
Next
chunkText = chunkText & Chr(10) & Mid('\$(row)', 2);
Next
[home1InlineTable] = [home1InlineTable] & chunkText;
Next
chunkText=''

[ClosestAssociations]:
SQL SELECT [home_home1_RelationId], [home.name], [home1.name], [home_home1_Distance], [home_home1_Route] FROM Closest(costUnit='Miles', distance='1', distanceType='car', closestCount='1', dataset1='home', dataset2='home1')
DATASOURCE home INLINE tableName='hometable', tableFields='name,lat,long', geometryType='POINTLATLON', loadDistinct='NO', suffix='', crs='Auto' {\$(homeInlineTable)}
DATASOURCE home1 INLINE tableName='hometable', tableFields='name,lat1,long1', geometryType='POINTLATLON', loadDistinct='NO', suffix='', crs='Auto' {\$(home1InlineTable)}
;
tag field [home_home1_RelationId] with '\$primarykey';
tag field [home_home1_Route] with '\$geoline';
tag field [home_home1_RelationId] with '\$geoname';
tag field [home_home1_Route] with '\$relates_home_home1_RelationId';
tag field [home_home1_RelationId] with '\$relates_home_home1_Route';

[homeInlineTable] = '';
[home1InlineTable] = '';

/* End GeoAnalytics operation Closest ----------------------------------- */

Employee

Hi,

What is the error message?

Try using more unique dataset names rather than home and home1.

Thanks,

Patric

Partner

Hello,

thank you for the nice training.

On page 24 in the last line stands "Set Location Options/Location Source to: Dimension"

Unfortunately I cannot find to point where to change this. Could you help and post a screenshot with the location?

Thank you.

Employee

Sorry, that's a typo in QV there is no option for that. QGA for QV will auto detect location.

Thanks,

Patric

Version history
Revision #:
2 of 2
Last update:
3 weeks ago
Updated by: