Qlik Community

Qlik GeoAnalytics Documents

Documents related to Qlik GeoAnalytics.

Announcements
See why BI users voted Qlik #1 in 11 categories. GET REPORT

Connector Examples Qlik GeoAnalytics

Employee
Employee

Connector Examples Qlik GeoAnalytics

Examples and guides for the Qlik GeoAnalytics Connector operations. The examples are self sufficient with data and reloadable. The examples are minimal to explain to basic functionality. Please use the documentation for details of the operations.

Although the examples are made with Qlik Sense the load script code will work in QlikView too. The following operations are covered

  • AddressPointLookup (Separate license required, Qlik Geocoding)
  • Binning 
  • Closest 
  • Cluster Guide 
  • Dissolve Guide 
  • Intersects 
  • IntersectsMost 
  • IpLookup 
  • Load 
  • NamedAreaLookup 
  • NamedPointLookup 
  • PointToAddressLookup (Separate license required, Qlik Geocoding)
  • Routes 
  • Simplify 
  • SpatialIndex 
  • TravelAreas 
  • Within 

Edit, the examples have been updated to use map chart.

Labels (3)
Attachments
Comments
Partner
Partner

Hi Patric,

I tried to use your example of Routes,  but did'nt manage to generate the script.

there is an error in the browser console on the developer tools on chrome.

I even tried to use your example on a new app with the same inline table.

After clicking next,  the insert button doesn't do anything and the console error shows up.

did i miss somthing?

BR,

Shay

 

1.png2.png

0 Likes
Employee
Employee

Ok, that looks strange, I could repeat the example without errors on my machine.

Which version of Qlik Sense, Web Browser and Qlik GeoAnalytics are you running?

Thanks,

Patric

 

 

0 Likes
Partner
Partner

Hi, 

Thanks for your reply,

Problem solved, after closing and reopening the browser.

Anyway, I am using Feb 12 for QS (Patch 1) & QGA 

and  Version 73.0.3683.86 (Official Build) (64-bit) of Chrome.

 

Shay

 

Partner
Partner

Hello Patric, 

I used your code like this :

/* Calculate travel areas with 30 min drive time from the sales offices. */
/* At the same time, load the sales offices data. */


LIB CONNECT TO 'GA_she (groupe_hvanderheyden)';


// /* Generated by Qlik GeoAnalytics for operation TravelAreas ---------------------- */
// SQL SELECT OfficeId, SalesOffices_TravelArea, SalesOffices_Status FROM TravelAreas(costValue='1800', costField='', costUnit='Seconds', transportation='car', dataset='SalesOffices')
// DATASOURCE SalesOffices CSV url='https://download.idevio.com/demodata/USLocationDemo/SalesOfficesNE.csv', keyField='OfficeId', geometryField='OfficePoint', geometryType='POINT', suffix='', encoding='UTF-8', fieldSeparator='TAB', recordSeparator='NEWLINE'
// SELECT OfficeId, OfficePoint, OfficeState FROM SalesOffices;
// SQL LOAD * FROM SalesOffices;
// /* End Qlik GeoAnalytics operation TravelAreas ----------------------------------- */


LIB CONNECT TO 'GA_she (groupe_hvanderheyden)';

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

IF FieldNumber('OfficeId', 'offices') = 0 THEN
call InvalidInlineData('The field OfficeId in offices is not available');
END IF
IF FieldNumber('OfficeLat', 'offices') = 0 THEN
call InvalidInlineData('The field OfficeLat in offices is not available');
END IF
IF FieldNumber('OfficeLon', 'offices') = 0 THEN
call InvalidInlineData('The field OfficeLon in offices is not available');
END IF
Let [SalesOfficesInlineTable] = 'OfficeId' & Chr(9) & 'OfficeLat' & Chr(9) & 'OfficeLon';
Let numRows = NoOfRows('offices');
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 'OfficeId', 'OfficeLat', 'OfficeLon'
row = row & Chr(9) & MapSubString('_inlineMap_', Peek('$(f)', $(rowNr), 'offices'));
Next
chunkText = chunkText & Chr(10) & Mid('$(row)', 2);
Next
[SalesOfficesInlineTable] = [SalesOfficesInlineTable] & chunkText;
Next
chunkText=''


[TravelAreas]:
SQL SELECT [OfficeId], [SalesOffices_TravelArea], [SalesOffices_Origin], [SalesOffices_Cost],[SalesOffices_CostUnit], [SalesOffices_Status]
FROM TravelAreas(costValue='30', costField='', costUnit='Minutes', transportation='car',
dataset='SalesOffices')
DATASOURCE SalesOffices INLINE tableName='offices', tableFields='OfficeId,OfficeLat,OfficeLon',
geometryType='POINTLATLON',
loadDistinct='NO', suffix='', crs='Auto' {$(SalesOfficesInlineTable)}
;


tag field [OfficeId] with '$primarykey';
tag field [SalesOffices_TravelArea] with '$geopolygon';
tag field [OfficeId] with '$geoname';
tag field [SalesOffices_TravelArea] with '$relates_OfficeId';
tag field [OfficeId] with '$relates_SalesOffices_TravelArea';

[SalesOfficesInlineTable] = '';

/* End GeoAnalytics operation TravelAreas ----------------------------------- */

I want now to have multiple layer depending of the  cost.

I tried to duplicate the code by changing the cost value but it doesn't work.

Could you help me ?

SQL SELECT [OfficeId], [SalesOffices_TravelArea], [SalesOffices_Origin], [SalesOffices_Cost],[SalesOffices_CostUnit], [SalesOffices_Status]
FROM TravelAreas(costValue='60', costField='', costUnit='Minutes', transportation='car',
dataset='SalesOffices')
DATASOURCE SalesOffices INLINE tableName='offices', tableFields='OfficeId,OfficeLat,OfficeLon',
geometryType='POINTLATLON',
loadDistinct='NO', suffix='', crs='Auto' {$(SalesOfficesInlineTable)}
;

0 Likes
Partner
Partner

Hi, 

I used your code to perform travel area and it's working.

I tried to duplicate the corresponding code to have many layers on the map, depending of the value of the cost field

But it's not working.

Could you help me ?

0 Likes
Employee
Employee

@savheid 

Use the connector wizard and fill in the values instead of copying the code.

Making three TravelAreas after each other works fine.

Here's a video to get started with connector:

https://www.youtube.com/watch?v=ley7BH87qXw

Thanks,

Patric

Partner
Partner

Hi Patric,

I tried to use your example of Dissolve,  but did'nt manage to generate the script  in qlikview.

IT is showing an error as below.

Dissolve.PNG

What is the mistake i am committing. Kindly let me know

Regards

Gokul

0 Likes
Employee
Employee

@gokulkumaravel note that when copying to QV, it's necessary to generate  a new connection string to the script. It's a button in the QGA connector dialogue.

Does any of the other scripts work?

Thanks,

Patric

0 Likes
Version history
Revision #:
5 of 5
Last update:
‎2020-04-28 09:05 AM
Updated by: