Academic and Career Talks

Talk about Academic Life and Career

Codes and Scripts

Articles with Code Snippets, programming, source codes, and useful scripts for development

Computers, Gadgets and Mobile Reviews

Gadget and Mobile Reviews

IBM DB2, Lotus Notes, Cognos

IBM, DB2, Lotus Notes, Cognos

Wordpress, Blogging and Useful Stuffs

Wordpress, Blogging and Useful Stuffs

Home » Business Intelligence and DataWarehousing Concepts, Codes and Scripts, IBM DB2, Lotus Notes, Cognos

Adding Google Maps to Cognos 10 Reports

Submitted by on Wednesday, 26 April 2017One Comment
Adding Google Maps to Cognos 10 Reports

I have an exciting project to add to my portfolio. What makes it more interesting is the additional requirement which need integration to Google Maps. I got the chance to explore about Google Maps the other day. Thankfully, I was able to integrate just one to my Cognos Dashboard.


1. Generate a list of countries with corresponding latitute and longitude. Be sure to have the city capital, region and country. This might help you build your list. Please follow this link ->
2. One must have an account to Google to access the Google API Javascript Library. Basically you need a key which allows you to utilize Google API Javascript v1.3.

Google Maps API

Google Maps API GET KEY

Please do read about the pricing plans. Essentially, Google Maps APIs are free for a wide variety of use cases, but there are limitations. In my case, I utilized the standard plan which has a standard 25,000 map loads per day.

Google Maps Pricing Plans

3. Launch Cognos Report Studio. When prompted, select the package you will use.
4. Assuming the report has already loaded and you have just started, from the Insertable Objects tab, drag list object and build your own query by adding fields into it. In my case, I added the country, revenue, amount and remaining count.
5. Insert an HTML item next to the remaining count data item (unlock cell first).
6. Change the source type to “Text”. Set the URL Source Type to Report Expression and define the report expression as follows:
for eg:


'<a href="#" onClick="displayInfo( '''+ number2string([CountApprovalNum])+', '+[OCOMaps].[City] +', '+[OCOMaps].[Country]+''')"> Show</a> <script>

displayLocation("' + [OCOMaps].[Address 2] + ', '+[OCOMaps].[City] +', '+[OCOMaps].[Country]+', '+[OCOMaps].[Cofr Country Mnemonic] + '"); </script> '


7. On the left side of the List Report, drag an HTML item before the list. Choose “Text” as source type.  and  type in the following:

<!--credits: -->
<script type="text/javascript" src="<PLACE YOUR CODE HERE>"></script>
<div id="map" class="map-container" style="width: 800px; height: 600px"></div>
<script type="text/javascript">

var latlng = new google.maps.LatLng(62.523696, 15.934835);

var options = {
center : latlng,
zoom : 3,
mapTypeId : google.maps.MapTypeId.ROADMAP

// Creating the map
var map = new google.maps.Map(document.getElementById('map'), options);

var geocoder = new google.maps.Geocoder();
var infowindow;

function displayLocation(a) {
displayMap(a, 0);

function displayInfo(a) {
displayMap(a, 1);

function displayMap(address, displayInfo) {
geocoder.geocode( {'address' : address}, function(results, status) {

if (status == google.maps.GeocoderStatus.OK) {
var marker = new google.maps.Marker( {
map : map,
position : results[0].geometry.location

if (!infowindow) {
infowindow = new google.maps.InfoWindow();


infowindow.setContent("<div style = 'width:150px;min-height:40px'>" + address + "</div>");
if (displayInfo == 1) {, marker);

} else {
// alert("Incorrect adress: " +status+address);


8.Run the report to test it.

9. Save the report and run. You will see a live Google Map in your report! When i click on the ‘Show’ icon, it pinpoints the map  according to it’s corresponding country indicated on the list.


Integrating Google Maps to Cognos 10 BI Reports


Here’s another video tutorial which may help you further

For more information, feel free to browse over the Techronnati boards


Thank you for visiting I hope you enjoy your stay. =)
Close Box