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
Very interesting post. Like it
ReplyDeletehi John thanks a lot it was very simple and helpful just 1 more thing i want to know if for example instead of pins let say i want to colour that region... like say any state in USA i want to feed some data in different colours for that paticular region how do i do that..???
ReplyDelete@Kwl_PranayJain,
ReplyDeletehave a look at oracle spatials or wait a bit for OBIEE 11G
Thanks a lot posting this. However I'm getting 'length' is null or not an object error message on IE8. Any idea?
ReplyDeleteJohn,
ReplyDeletebeen reading for a while, first time commenting...this map feature works great. I wondered if there was also a way to build in criteria that once I bring back customer on the map, find other customer within 15 miles, 30 miles, etc?? Thought that would be a helpful addition to this tool for sales team...