Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
nisreen2019
Contributor
Contributor

GeoQlik 2 layer intersection

Hello everybody!

 

 

I have multiple layers on Qliksense (Geoqlik map), the user wants to select shape file  layer and it takes so long time to select it maybe because of the size which is 300 KB, any how my question is the user wants to select shape layer to find how many point in that layer.

 

The point information exists in another Bubble layer with Long and Lat info

 

 

Is there any way to find the intersection between these 2 layers as the answer

 

 

I am really tierd with that please give me suggestions if you have

 

 

see the attached pic, if the user selects the blue layer, must show how many squares above that layer maybe 20 point then the number above the map will be changed. Plz help 😞

Labels (4)
1 Solution

Accepted Solutions
Patric_Nordstrom
Employee
Employee

Rendering that many points takes time and is also not easy for the user to understand. To create intermediate overlay layers by grouping data using the QGA operations cluster, binning et al.

To build relationships between point datasets I recommend the QGA Closest operation.

Between point and areas, use the QGA Within operation.

https://help.qlik.com/en-US/geoanalytics/Content/Qlik_GeoAnalytics/GeoAnalytics-Connector/GeoAnalyti...

Thanks,

Patric

View solution in original post

3 Replies
Patric_Nordstrom
Employee
Employee

Rendering that many points takes time and is also not easy for the user to understand. To create intermediate overlay layers by grouping data using the QGA operations cluster, binning et al.

To build relationships between point datasets I recommend the QGA Closest operation.

Between point and areas, use the QGA Within operation.

https://help.qlik.com/en-US/geoanalytics/Content/Qlik_GeoAnalytics/GeoAnalytics-Connector/GeoAnalyti...

Thanks,

Patric

nisreen2019
Contributor
Contributor
Author

Yes Patric you are the best:) Within was the secret that I would never guess without your note

 

 

Just one more question here please, I have 10 area layers and one point bubble layer, all intersect with that point layer

 

 

So it is not logic to create within operation 10 times for each layer seperately, right?

 

Even though, I would have 10 point layers as result and all are the same info!

 

 

So what is the suggested solution please, the code looks like that :

 

LatLong:
LOAD //Address as %FullAdress, 
Replace("Id_num",'-','') as %Personnummer,
    Latitude,
    Longitude,
 AdressMatch,
 GeoMakePoint(Latitude, Longitude) as LocationInSweden;
SQL SELECT
 Id_num,
    AdressMatch,
    Latitude,
    Longitude
FROM "xxxxxxxxxxxxxx";

 

 

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

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


[WithinAssociations]:
SQL SELECT [%Personnummer], [_autoIndex_] FROM Within(enclosed='Enclosed', enclosing='Enclosing')
DATASOURCE Enclosed INLINE tableName='LatLong', tableFields='%Personnummer,Latitude,Longitude', geometryType='POINTLATLON', loadDistinct='NO', suffix='', crs='Auto' {$(EnclosedInlineTable)}
DATASOURCE Enclosing GEOFILE url='file:////xxxxxxxxxxxxxx', keyField='', type='shape', expectedGeomType='polygon', encoding='', crs='Auto'
SELECT [%Personnummer], [Enclosed_Geometry] FROM Enclosed
SELECT [OBJECTID], [ID], [Area], [Gridcode], [Namn], [Shape_area], [Shape_len], [Geometry], [_autoIndex_] FROM Enclosing;
[Enclosed]:
SQL LOAD * FROM Enclosed;
[Enclosing]:
SQL LOAD * FROM Enclosing;
tag field [%Personnummer] with '$primarykey';
tag field [%Personnummer] with '$primarykey';
tag field [Enclosed_Geometry] with '$geopoint';
tag field [%Personnummer] with '$geoname';
tag field [Enclosed_Geometry] with '$relates_%Personnummer';
tag field [%Personnummer] with '$relates_Enclosed_Geometry';
tag field [_autoIndex_] with '$primarykey';
tag field [Geometry] with '$geopolygon';
tag field [_autoIndex_] with '$geoname';
tag field [Geometry] with '$relates__autoIndex_';
tag field [_autoIndex_] with '$relates_Geometry';

[EnclosedInlineTable] = '';

/* End GeoAnalytics operation Within ----------------------------------- */

 

 

Note: see the attached image which shows the long time waiting when add 2 within operation more than 30 minutes 😞

Patric_Nordstrom
Employee
Employee

When working with large tables of indata, I recommend to split up the calls, see this article. It's an easy modification:

https://community.qlik.com/t5/Qlik-GeoAnalytics-Documents/Splitting-up-GeoAnalytics-connector-operat...

 

Thanks,

Patric