Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
ruanhaese
Partner - Creator II
Partner - Creator II

Determine if geopoint within polygon

Hi All

 

I'm investigating whether its possible to determine if a geopoint is within a polygon.

I think this is possible with some of the paid extensions and with GeoAnalytics, however neither of these are options,

I can only work with the base Qlik Sense product.

 

So far I've found this mathematical formulae that can calculate it, however this is in python and java

Albeit possible to convert, just wondering if I'm running down the wrong path here before I get in too deep.

 

int pnpoly(int nvert, float *vertx, float *verty, float testx, float testy)
{
int i, j, c = 0;
for (i = 0, j = nvert-1; i < nvert; j = i++) {
if ( ((verty[i]>testy) != (verty[j]>testy)) &&
(testx < (vertx[j]-vertx[i]) * (testy-verty[i]) / (verty[j]-verty[i]) + vertx[i]) )
c = !c;
}
return c;
}

 

Just wondering if anybody has dealt with something like this before and has any tips.

 

Thank you

Labels (2)
1 Reply
ruanhaese
Partner - Creator II
Partner - Creator II
Author

* Both my geopoints and geoAreas are imported correctly, and display on my maps.

 

Example Data:

Table1:

Name,   GeoArea

Site1,  [[ -25.4, 28.9 ], [ -22.4, 28.9 ], [ -25.4, 24.9 ]]

 

Table2:

StoreName, GeoPoint

Store1,  [ -23.3, 26.4]