OBIEE

Simple and fast integration between OBIEE and Google Maps

If you have a little report with a simple store locator and you don’t want to setup Maps in Oracle BI, you can use Google Maps API to simply integrate a map in Oracle BI Dashboard.

OBIEE integration with Google Map
OBIEE integration with Google Map

To use Google Maps API you need a key. To obtain this, register with Google API Console at url https://code.google.com/apis/console/, then click on “Api access” and next on button “Create new server key“. Insert “http://your_server:9704/analytics/saw.dll” as your “Accept requests from these server IP addresses”. Click create and your key will be generated.

This solution works for either a single or multiple locations. First, create with Answer a simple table with the data of a physical location (address, city, state, ecc):

A simple table with geographic data
A simple table with geographic data

 

To obtain your map we can create a new “Narrative View” (sorry, my installation is in Italian 🙂 ):

Edit the Narrative View with the following code:

Create a new Narrative View
Create a new Narrative View
Create a new Narrative View
Create a new Narrative View

Prefix Section
(replace YOUR_KEY with your own Google Maps API key)

<script src='http://maps.google.com/maps?file=api&v=2&sensor=false&key=YOUR_KEY' type='text/javascript'></script>
<script type='text/javascript'><!--
// Declarations
var map = null;
var geocoder = null;
var marker = null;
window.onload = addCodeToFunction(window.onload, function() {
if (GBrowserIsCompatible()) {
// Create the map
map = new GMap2(document.getElementById("map_canvas"));
// Set the center without markers; 13 is the zoom level
//map.setCenter(new GLatLng(37.4419, -122.1419), 9);
// Add the compass and zoom control
map.addControl(new GLargeMapControl());
// Add the Map type control
map.addControl(new GMapTypeControl());
// Get a new geocoder (needed to convert adresses to coordinates
geocoder = new GClientGeocoder();
// Get the ICON for the marker
icon0 = new GIcon();
icon0.image = 'http://www.google.com/mapfiles/marker.png';
icon0.shadow = 'http://www.google.com/mapfiles/shadow50.png';
icon0.iconSize = new GSize(20, 34);
icon0.shadowSize = new GSize(37, 34);
icon0.iconAnchor = new GPoint(9, 34);
icon0.infoWindowAnchor = new GPoint(9, 2);
icon0.infoShadowAnchor = new GPoint(18, 25);
// Get the Adresses
GetMapAdress();
}
});
function showAddress(address,comment) {
// Coverts adresses to coordinates and set the marker on the chart
if (geocoder)
{
geocoder.getLatLng
(
address,
function(point)
{
if (!point)
{
//alert(address + " not found");
}
else
{
map.setCenter(point, 9);
var marker = createMarker(point,icon0,comment);
map.addOverlay(marker);
// Opens the last marker
// marker.openInfoWindowHtml(comment);
}
}
);
}
}
function createMarker(point, icon, popuphtml)
// Creates the marker
{
var popuphtml = "<div id='popup'>" + popuphtml + '</div>'
var marker = new GMarker(point, icon);
GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml(popuphtml);});
return marker;
}
function addCodeToFunction(func, code){
if(func == undefined)
return code;
else{
return function(){
func();
code();
}
}
}
function GetMapAdress()
{

Description Section

// From here it's build dynamicly in OBIEE
showAddress('@1', '@2');

Replace @1 and @2 in this script with the index of the column containing the text you want to view in the box that appears when you click on interesting point.

Postfix Section

}
window.onunload = GUnload();
<div id="map_canvas" style="width: 800px; height: 600px"></div>

Ensure that the checkbox “Contains HTML Markup” is checked:
sample3

Save the answer and insert it in a Dashboard: you can view the map only in Dashboard view:

sample4

That’s all. In a few minutes we got a simple map included in our report.
I tested this solution with OBIEE 11.1.1.6.6 on Win x64 Platform.

Thanks to: http://www.artofbi.com/blog/obiee-and-google-maps-integration/

One Comment

  • Marcelo

    Hi Michele, I already try to build some map with this example that you provide us, but I can’t.
    Firstyble, thanks for this example!
    I have my server key already created, I can use html on obiee, so I already have too this step configurated.
    But I think that my wrong its in my data set..With your zip code, you draw the porcion of the map that you need?
    I can’t draw any porcion of any map hahah. you can help my please?

Leave a Reply