I showed how to integrate Google Maps into OBIEE. Doing the same with Microsoft Bing maps is slightly different. There service is completely asynchronous, which meant a slightly different approach for the narrative view.
Let’s start with the basics. Get your addresses and a extra column for the array counter. This is just a RCOUNT – 1.
Switch to a narrative view. In the prefix part put:
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2"></script>
<script>
var map = null;
var count = 0;
var adr = new Array();
var cmt = new Array();
var Center = new VELatLong(52, 6);
var ZoomLevel = 7;
function GetMap()
{
in the narrative put:
adr[@1]="@3";cmt[0]="@2";
In the postfix part put:
map = new VEMap('myMap'); map.LoadMap();
map.SetCenterAndZoom(Center, ZoomLevel);
FindLocation(adr[0]);
}
function FindLocation(searchstr)
{
if (searchstr != '')
{
map.Find(null, searchstr, null, null, null, null, false, null, null, false, AddPin);
}
}
function AddPin(layer, resultsArray, places, hasMore, veErrorMessage)
{
if(places.length > 0)
{
var shape = new VEShape( VEShapeType.Pushpin,places[0].LatLong);
shape.SetTitle(places[0].Name);
//alert(comments[count]);
shape.SetDescription(cmt[count]);
map.AddShape(shape);
map.SetCenterAndZoom(Center, ZoomLevel);
}
count++;
if(count<adr.length)
FindLocation(adr[count]);
}
</script>
</head> <script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready( function(){GetMap();return false;
}
);
</script>
<body> <div id='myMap' style="position:relative; width:800px; height:600px;"></div> </body>
Don’t forget to set Contains HTML:
Add it to the compound Layout:
I personally find this webservice slower then the one from Google, but maybe some better coding could fix that. If you have any ideas, please let me know.
Till Next Time