If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Google Maps w/ ReportNet

Started by mikegreen, 08 Nov 2005 10:47:51 AM

Previous topic - Next topic

mikegreen

Ok, I got my interest peaked with the tutorial showcase on google maps with CRN data.

Any more info, ReportNet Addict? :-)

I'm playing a bit with Series 8's Mapping functionality, but would like to see what Google Map's integration with certain data... Mainly, because it you can integrate with Google Maps, you can most likely do Google Earth as well.

Cheers,

Mike

pmcghiey

Since the google map API is all javascript base you can add it to any report via HTML Items.Ã,  I have done some simple reports with it by wrapping the report data around HTML Items in order to manipulate the google map object.

It took me a while to get it working because of different problems the api has with browsers and how ReportNet renders reports.

Some things I ran into:

  • IE sometimes had issues with the javascript in a table.Ã,  I had to write everything in functions and then call the functions.
  • It is helpful to have the geocoding information in the datasource.Ã,  The API does not include a geocoder and the mozilla browser does not allow you to access remote domains via javascript (IE does though).Ã,  You could do something in .Net to access remote geocoders like geocoder.us

If I get some free time I will try to do something for the gosales package.

sir_jeroen

You got Cognos 8.. I thought it wasn't released yet.. :D

sir_jeroen

pmcghiey:
Post me a message when you're getting into this... let me know how you do this...I'm very interested too!!! Maybe I can help you...
Mike:
tnx for the compliment, just as pmc stated it's all done by javascript (psst...don't tell anyone :D) Therefore it can't be rendered to pdf.

Your problem with google earth will be the passing of multiple values to your api... So you'll have to start a request which handles all incoming values and when all values are passed then you'll have to start processing the values... But i'm not a real programmer so pin me down on this :D

Good luck

MFGF

Hi RA,

Quote from: ReportNet Addict on 09 Nov 2005 06:49:26 AM
You got Cognos 8.. I thought it wasn't released yet.. :D

Cognos 8 is currently on "controlled release". Some lucky folks do have it. :)

Apologies for the off-topic reply!

MF.
Meep!

sir_jeroen


mikegreen

Quote from: ReportNet Addict on 09 Nov 2005 06:49:26 AM
You got Cognos 8.. I thought it wasn't released yet.. :D

It is is controlled release as MFGF said below... We have a Series 7 setup that we want to pitch the upgrade to a client, along with more functionality... Cognos was very tight about release, pretty much gave up my first born, right arm, left leg, and a few other things just to get it a few weeks early. 

I will say, DAMN, very impressive. The use of PowerPlay cubes inside Report Studio and Query Studio (which is very much improved) is very nice.  It took me about 2 hours from install start to displaying reports in Report Viewer using a Series 7 cube. Didn't even have to rebuild it in the new ver.

That said, it should be out in 2 weeks for general release... I'm not sure what the upgrade policy is for Series 7 licensees..?

Cheers,

Mike

sir_jeroen

Send me a copy... ReportNet_addict@hotmail.com just cut it up in small pieces... If you do i'm eternally gratefull :D:D

mikegreen

Hah! As much as I appreciate the site here and what you do, I can't :-(

I know some Cognos folks read here... and any inclination that I distro'ed it wouldn't look to good on our company nor myself. 

Cheers,

Mike

sir_jeroen


rvitatoe

I just saw a demo today...Ã,  All the things I thought they overlooked and didn't include in Reportnet...Ã,  Are there...Ã,  All the dumb little nuances that drove me crazy Reportnet... seem to be fixed...Ã,  All in all, it looks like they took the bad, and fixed it... they took the good, and made it sweeter :)Ã,  Very nice!

I did overhear something about it NOT being a 1 to 1 license upgrade though... (Like maybe it's gonna cost more per license)
Official release is Monday Nov 14 (They said)

pmcghiey

Here is a simple report using google maps that shows the Top 10 Sales branches in the US (although I think there are only 4 in the default framework).Ã,  The map will show an icon on the map where each location is and when the icon is clicked it will show the rank and revenue for that location.Ã,  If order to get this to work in your environment you will need to get a google map api key (located at http://www.google.com/apis/maps/ ) and a yahoo appid for the geocodeing portion (located at http://api.search.yahoo.com/webservices/register_application ).Ã,  Both of these keys are free to obtain and contain their own license agreements.Ã,  When you get your keys you will need to update the report and replace your values with the placeholders: COPYGOOGLEAPIKEYHERE and COPYYAHOOKEYHERE

The report will get the geocode address via javascript to the yahoo geocoding application which means this report only runs in IE since Mozilla browser prevents javascript from reaching urls outside of the current domain the page is coming from.Ã,  You could get around this by coding the geocoding part as some sort of cgi program on your web server (i.e. .Net, php, perl, etc.).Ã,  For the scope of this example I just used the javascript methods.

<report xml:lang="en-us" xmlns="http://developer.cognos.com/schemas/report/1/"><!--RS:1.1-->
<layoutList>
<layout>

<pageSet>

<page name="Page1">
<pageBody><HTMLItem>
<HTML>&lt;script src="http://maps.google.com/maps?file=api&amp;v=1&amp;key=COPYGOOGLEAPIKEYHERE" type="text/javascript"&gt;&lt;/script&gt;
&lt;div id="map" style="width: 800px; height: 600px"&gt;&lt;/div&gt;
&lt;script type="text/javascript"&gt;
var map=null;
var marker_pts = new Array();
var marker_addr = new Array();

function BuildMap()
{
map = new GMap(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.centerAndZoom(new GPoint(-89.97751235961914, 35.036040449168695), 13);
getPosition2();
displayMarkers();
}

function getPosition2()
{
for (var i=0; i&lt;marker_addr.length;i++)
{
var tmp_addr = marker_addr[i].split("~");
var address = tmp_addr[0];
var city = tmp_addr[1];
var state = tmp_addr[2];
var revenue= tmp_addr[3];
var rank = tmp_addr[4];
var request = GXmlHttp.create();
var tmpaddr = "&amp;street=" + address + "&amp;city=" + city +"&amp;state=" + state;

request.open("GET", "http://api.local.yahoo.com/MapsService/V1/geocode?appid=COPYYAHOOKEYHERE" + tmpaddr, false);
request.send();
var xmlDoc = request.responseXML;
var lngmrk = xmlDoc.documentElement.getElementsByTagName("Longitude");
var latmrk = xmlDoc.documentElement.getElementsByTagName("Latitude");
var tmp_point = lngmrk[0].firstChild.nodeValue + "~" + latmrk[0].firstChild.nodeValue + "~" + revenue + "~" + rank;
marker_pts[marker_pts.length] = tmp_point;
}

}

function getPosition(address,city,state,revenue,rank)
{
var tmp_point = address + "~" + city + "~" + state + "~" + revenue + "~" + rank
marker_addr[marker_addr.length] = tmp_point
}

function displayMarkers()
{
for (var i=0; i&lt;marker_pts.length; i++)
{
var tmp_pt = marker_pts[i];
var ar = tmp_pt.split("~");
var point = new GPoint(parseFloat(ar[0]),parseFloat(ar[1]));
createMarker(point,ar[2],ar[3]);

}
}

function createMarker(point,revenue,rank)
{
var marker = new GMarker(point);
map.addOverlay(marker);
GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml("&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;Revenue:&lt;/b&gt;&lt;/td&gt;&lt;td&gt;" + revenue+ "&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;Rank:&lt;/b&gt;&lt;/td&gt;&lt;td&gt;" + rank + "&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;"); });
}
self.setTimeout('BuildMap()',1000);
&lt;/script&gt;
&lt;br&gt;</HTML></HTMLItem>
<block><list refQuery="Query1">
<listColumnTitles><listColumnTitle><textItem><queryItemRef content="label" refItem="Country"/></textItem></listColumnTitle><listColumnTitle><textItem><queryItemRef content="label" refItem="Address line 1"/></textItem></listColumnTitle><listColumnTitle><textItem><queryItemRef content="label" refItem="City"/></textItem></listColumnTitle><listColumnTitle><textItem><queryItemRef content="label" refItem="Region"/></textItem></listColumnTitle><listColumnTitle><textItem><queryItemRef content="label" refItem="Postal zone"/></textItem></listColumnTitle><listColumnTitle><textItem><queryItemRef content="label" refItem="Revenue"/></textItem></listColumnTitle><listColumnTitle><textItem><queryItemRef content="label" refItem="Rank"/></textItem></listColumnTitle><listColumnTitle><textItem><queryItemRef content="label" refItem="Map Anchor"/></textItem><style><CSS value="display:none"/></style></listColumnTitle><listColumnTitle><textItem><text>HTML Item</text></textItem><style><CSS value="display:none"/></style></listColumnTitle></listColumnTitles>
<listColumns><listColumn refLevel="Country"><textItem><queryItemRef refItem="Country"/></textItem></listColumn><listColumn><textItem><queryItemRef refItem="Address line 1"/></textItem></listColumn><listColumn><textItem><queryItemRef refItem="City"/></textItem></listColumn><listColumn><textItem><queryItemRef refItem="Region"/></textItem></listColumn><listColumn><textItem><queryItemRef refItem="Postal zone"/></textItem></listColumn><listColumn><textItem><queryItemRef refItem="Revenue"/></textItem><style><CSS value="text-align:right"/></style></listColumn><listColumn><textItem><queryItemRef refItem="Rank"/></textItem><style><CSS value="text-align:right"/></style></listColumn><listColumn><textItem><queryItemRef refItem="Map Anchor"/></textItem><style><CSS value="text-align:right;display:none"/></style></listColumn><listColumn><HTMLItem>
<queryItemRef refItem="Map Anchor"/></HTMLItem><style><CSS value="border-top-style:none;border-top-color:white;border-left-style:none;border-left-color:white;border-bottom-style:none;border-bottom-color:white;border-right-style:none;border-right-color:white"/></style>
</listColumn></listColumns>
<style>
<CSS value="border-collapse:collapse"/>
</style>
<XMLAttribute name="RS_ListGroupInfo" value="Country"/></list>
</block>
</pageBody>
</page></pageSet></layout>
</layoutList>
<modelConnection name="/content/package[@name='GO Sales and Retailers']/model[@name='model']"/><querySet xml:lang="en-us"><BIQuery name="Query1"><cube><factList><item refItem="Address line 1" aggregate="none"/><item refItem="City" aggregate="none"/><item refItem="Region" aggregate="none"/><item refItem="Postal zone" aggregate="none"/><item refItem="Revenue" aggregate="none"/><item refItem="Rank" aggregate="none"/><item refItem="Map Anchor" aggregate="none"/></factList><dimension name="Country"><level name="Country"><item key="true" refItem="Country" aggregate="none"/></level></dimension></cube><tabularModel><dataItem name="Country" aggregate="none"><expression>[gosales_goretailers].[Countries].[Country]</expression></dataItem><dataItem name="Address line 1" aggregate="none"><expression>[gosales_goretailers].[Sales branch address].[Address line 1]</expression></dataItem><dataItem name="City" aggregate="none"><expression>[gosales_goretailers].[Sales branch address].[City]</expression></dataItem><dataItem name="Region" aggregate="none"><expression>[gosales_goretailers].[Sales branch address].[Region]</expression></dataItem><dataItem name="Postal zone" aggregate="none"><expression>[gosales_goretailers].[Sales branch address].[Postal zone]</expression></dataItem><dataItem name="Revenue" aggregate="total"><expression>[gosales_goretailers].[Orders].[Revenue]</expression></dataItem><dataItem name="Rank"><expression>rank([Revenue])</expression></dataItem><filter use="required" summary="false"><condition>[Country]=('United States')</condition></filter><filter use="required" summary="true"><condition>[Rank] &lt;= 10</condition></filter><dataItem name="Map Anchor"><expression>'&lt;script language="javascript"&gt;getPosition("' +[Address line 1]+ '","' + [City] + '","' + [Region] +'","' + cast([Revenue],varchar(20)) + '",' + cast([Rank], char)+Ã,  ');&lt;/script&gt;'</expression></dataItem></tabularModel></BIQuery></querySet></report>

sir_jeroen

Quote from: mikegreen on 08 Nov 2005 10:47:51 AM
Ok, I got my interest peaked with the tutorial showcase on google maps with CRN data.

Any more info, ReportNet Addict? :-)

I'm playing a bit with Series 8's Mapping functionality, but would like to see what Google Map's integration with certain data... Mainly, because it you can integrate with Google Maps, you can most likely do Google Earth as well.

Cheers,

Mike

Mike....and to tease you a little bit more... IÃ,´ve already been able to create PDFÃ,´s with GIS information based on the data in a list object using Arc maps...

Maybe IÃ,´m going to share the code... but first IÃ,´ll have to boost up the performance

mikegreen

Quote from: pmcghiey on 14 Nov 2005 10:05:09 AM
Here is a simple report using google maps that shows the Top 10 Sales branches in the US (although I think there are only 4 in the default framework).Ã,  The map will show an icon on the map where each location is and when the icon is clicked it will show the rank and revenue for that location.Ã,  If order to get this to work in your environment you will need to get a google map api key (located at http://www.google.com/apis/maps/ ) and a yahoo appid for the geocodeing portion (located at http://api.search.yahoo.com/webservices/register_application ).Ã,  Both of these keys are free to obtain and contain their own license agreements.Ã,  When you get your keys you will need to update the report and replace your values with the placeholders: COPYGOOGLEAPIKEYHERE and COPYYAHOOKEYHERE


Just an FYI... I used this as a base to play with some of our data - I didnt have a Yahoo API Key and left COPYYAHOOKEYHERE in the report - and it runs like that..

?!

Thanks for the code.. it has been quite helpful! I'll post some samples sometime in the near future, too.

Mike

MrO

Thank you very much pmcghiey, for not only showing of, but also sharing this great example!

Thank you!!!

sir_jeroen

Oh... are you addressing to me ;)

jeemalif

Hi guys.

I am relatively new to Report Net, and just found this website today. Would anyone be able to share how to create the report from the code that is posted by "pmcghiey"  on Nov 14th?

Thanks,
Javed

bdybldr

Javed,
Copy entire code block and paste it in Notepad.Ã,  Make sure you have everything.  Select all and copy again.Ã,  Then, open Report Studio and go to Tools>Open report from clipboard.Ã,  This will create a report using the xml specification that was posted.