# GeoAnalytics

Discussion Board for collaboration regarding Qlik GeoAnalytics.

Announcements
QLIKWORLD LIVE! MAY 16 - 19TH, EARLY BIRD DISCOUNTS! REGISTER TODAY
cancel
Showing results for
Did you mean:
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?

Regards,

Matsa

Labels (1)
• ### General Question

1 Solution

Accepted Solutions
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

4 Replies
Partner

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)

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

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

Creator
Author

Thanks @Patric_Nordstrom  for the solution.

regards,

Matsa

Community Browser