Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Matsa
Creator
Creator

Central point of shape in Geoanalytics

Hi experts,

We are using Qlikview and Geoanalytics.

I have one question, we need to create chart layer and bubble layer but we don't have longitudine and latitudine.

we have Just shape.we created our layers based on first point of shape, but since they have overlapping, we need to change it,now I want to know is there any way in order to get central point of on shape?

 

Thank you in advance.

Regards,

Matsa

Labels (1)
1 Solution

Accepted Solutions
Patric_Nordstrom
Employee
Employee

One way could be to use the average of coordinates. Works ok the shapes are fairly conform, not too "kidney like".

load cc, purgechar(replace(c_Geometry,'],[','|'),'[]') as plist Resident c;
pts: load cc, '[' & subfield(plist,'|') & ']' as pt Resident c;
// Extract coordinates
x: load cc, purgechar(subfield(pt,',',1),'[]') as x Resident pts;
y: load cc, purgechar(subfield(pt,',',2),'[]') as y Resident pts;
// Calculate center
cx: load cc, avg(x) as cx Resident x group by cc;
cy: load cc, avg(y) as cy Resident y group by cc;

See the example.

Thanks,

Patric

View solution in original post

4 Replies
martyginqo
Partner - Creator
Partner - Creator

Hi Matsa,

If you happen to also be using Qlik Sense (some of our customer have dual licenses) - you could use the GeoGetPolygonCenter() function in the script and then write out the center points to bring back to QlikView. Unfortunately, I don't think the function exists in QlikView.

 

GeoSpatialFunctions (Qlik Help)

Matsa
Creator
Creator
Author

Hi @martyginqo ,Thank you for the response,unfortunatly we do not have license for qliksense.

anyway thank you for the information.

Regards,

Matsa

Patric_Nordstrom
Employee
Employee

One way could be to use the average of coordinates. Works ok the shapes are fairly conform, not too "kidney like".

load cc, purgechar(replace(c_Geometry,'],[','|'),'[]') as plist Resident c;
pts: load cc, '[' & subfield(plist,'|') & ']' as pt Resident c;
// Extract coordinates
x: load cc, purgechar(subfield(pt,',',1),'[]') as x Resident pts;
y: load cc, purgechar(subfield(pt,',',2),'[]') as y Resident pts;
// Calculate center
cx: load cc, avg(x) as cx Resident x group by cc;
cy: load cc, avg(y) as cy Resident y group by cc;

See the example.

Thanks,

Patric

Matsa
Creator
Creator
Author

Thanks @Patric_Nordstrom  for the solution.

regards,

Matsa