Qlik Community

QlikView Documents

Documents for QlikView related information.


Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

OpenCPU, R, Google GeoCharts & QlikView Integration Example

Not applicable

OpenCPU, R, Google GeoCharts & QlikView Integration Example

Here is an example of integrating with R using an extension and using the results to plot markers on a Map. This example builds on Sam Pena's extension http://community.qlik.com/docs/DOC-4383 and uses the data from his R function ClusterAnalysis to plot the results as markers using a Google GeoChart. If you wish to understand the details of the R Integration solution on its own, please refer to Sam's original post. It contains an excellent write up of the solution kit for integrating with R / OpenCPU.

This extension calls out to the ClusterAnalysis R function on OpenCPU and returns a set of cluster values related to the Cities. Using the results returned a GeoChart is created plotting markers on the Cities returned and using the R results to enhance the data calculated by QlikView.

  • Average Order Size: metric calculated by QlikView. It is being used to control the color of the markers in this example
  • Cluster Group: calculated and returned from the ClusterAnalysis R function. It is being used to control the size of the markers.

To enable the user to select the cluster groups they want to display on the map, an island table was created with possible Cluster Groups defined. This allows the map to limit the cluster groups without modifying the results coming back from the R function.

The markers are being plotted using latitude and longitude to increase the speed of rendering the map.

The Extension package comes with an extension QAR file and an example application QVW. The QAR file must be installed prior to using the application.

Not applicable

Google's GeoCharts with markers can be notoriously slow. When plotting markers using City Name or Zip Code - the markers must be geocoded prior to rendering. This example uses Latitude and Longitude values to increase the speed with which the GeoChart renders and plots the markers. This prevents the GeoChart from calling out to the Geocoding API to retrieve these coordinates. Google will typically throttle these requests further slowing down the process. This results in a map that appears initially empty and begins to sporadically plot markers while the user waits. There can be a noticeable delay in the complete rendering of all markers, especially if more than 10-20 are being displayed. To the user it looks as though the chart is being slowly animated. Using the coordinates instead of City or Zip prevents this from happening and the Map renders complete with all markers plotted.

When plotting with Latitude and Longitude however, you are faced with an tool tip location which gives the coordinate values and is not particularly user friendly. To overcome this issue a description column has been added immediately following the Latitude and Longitude in the DataTable in the source code. This is undocumented by Google but allows for a Label (in this case City name) to be displayed in the hover over tool tip, instead of the Lat/Long coordinates.

Here's a code snippet that creates a data table that will render markers by coordinate and still display a city name.:

      var dataTable_cluster = new google.visualization.DataTable();

      dataTable_cluster.addColumn('number', 'LATITUDE', 'Latitude');

      dataTable_cluster.addColumn('number', 'LONGITUDE', 'Longitude');

      dataTable_cluster.addColumn('string', 'DESCRIPTION','Description');

      dataTable_cluster.addColumn('number', 'Average Order Size');

      dataTable_cluster.addColumn('number', 'Cluster Group');

Not applicable


   Great approach on using the Latitude and Longitude on increasing the speed to plot coordinates. This approach solves a common mapping scenario when dealing with markers and speed to display data.

Not applicable

@Matthew Bulmer,

Hi Matthew,

Can you please explain me how to integrate Qv with opencpu.

I am unable to do it.

Thanks & Regards


Version history
Revision #:
1 of 1
Last update:
‎11-05-2013 07:32 PM
Updated by: