Qlik Community

Qlik GeoAnalytics Discussions

Discussion Board for collaboration regarding Qlik GeoAnalytics.

Announcements
Qlik Analytics Tour 2020 Online. Begins August 10th. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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 (2)
1 Solution

Accepted Solutions
Highlighted
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
Highlighted
Partner
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)

Highlighted
Creator
Creator

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

anyway thank you for the information.

Regards,

Matsa

Highlighted
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

Highlighted
Creator
Creator

Thanks @Patric_Nordstrom  for the solution.

regards,

Matsa