Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW

Connector Examples Qlik GeoAnalytics

No ratings
cancel
Showing results for 
Search instead for 
Did you mean: 
Patric_Nordstrom
Employee
Employee

Connector Examples Qlik GeoAnalytics

Last Update:

Apr 2, 2021 4:29:01 AM

Updated By:

Patric_Nordstrom

Created date:

Feb 22, 2019 9:34:42 AM

Attachments

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.

Comments
shaybitton
Partner - Contributor III
Partner - Contributor III

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
Patric_Nordstrom
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
shaybitton
Partner - Contributor III
Partner - Contributor III

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

 

savheid
Partner - Contributor
Partner - Contributor

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
savheid
Partner - Contributor
Partner - Contributor

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
Patric_Nordstrom
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

gokulkumaravel
Partner - Contributor
Partner - Contributor

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
Patric_Nordstrom
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
sergiorey
Partner - Creator
Partner - Creator

Hi Patric,

Hope you are fine!

I tried to follow your example of TravelAreas and it is working fine with a costValue defined and blank costField but not working when using a specified CostField and blank CostValue. We are getting the following error:

QVX_FIELD_NOT_FOUND: Trying to get unknown column name: radius in the dataset Dataset

Where "radius" is the field used in "CostField" and it is available in the loaded table specified in the connection wizard.

Any ideas on this error?

Thanks in advance!

Regards,

Sergio.

PD:
Qlik Sense June 2020 and Qlik GeoAnalytics September 2019 using "bird" as transportation.

0 Likes
Patric_Nordstrom
Employee
Employee

The cost field has to be included in the table fields :

 

ta.png

Version history
Last update:
‎2021-04-02 04:29 AM
Updated by: