Home
Analytics
BIRT and Google Maps - what am I doing wrong?
BRM
<p>I am trying to create maps using the BIRT Google Maps library of some call center data by area code. I am pretty much trying to mimic the Areas.rptdesign that is in the examples for the Google Maps library. That report works fine for me but what I get is a report that spans many, many pages and only contains map data on the very last page.</p><p> </p><p>I have attached a rptdesign and my data. The Google maps library I am using is also included in the *.zip.</p><p> </p><p>Please help me understand what I am doing wrong. I am grateful for any and all help. Thank you.</p><p> </p><p>BRM</p>
Find more posts tagged with
Comments
PuckPuck
<p>the issue with your report here is the multi pages + fixed layout.</p><p> </p><p>The way the Google Maps extension works, is it is all client side javascript code to populate the map points to draw, as well as to render the map. if these parts fall on different pages (particularly the code that tells the map to render) you will not see a map.</p><p> </p><p>They're are more elegant ways of doing this, where you can build a very long JSON object in memory, then emit that to the Google Maps framework, but that will require some effort and raise the complexity of your report.
For the sake of just taking what you did and making it work, you need to set the report to be Auto Layout instead of Fixed (top level report component, property), and set the page break on the inner and outer table to be 0 rows.
I attached a fixed rptdesign</p>
kclark
<p>FWIW -- I've got Google maps working using this code too.</p><pre class="_prettyXprint _lang-"><!DOCTYPE html><html> <head> <title>Asynchronous Loading</title> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"> <meta charset="utf-8"> <script>function initialize() { alert("init"); var mapOptions = { zoom: 8, center: new google.maps.LatLng(-34.397, 150.644) }; var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions); alert("done");}function loadScript() { alert("loading"); var script = document.createElement('script'); script.type = 'text/javascript'; script.src = 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&' + 'callback=initialize'; document.body.appendChild(script); alert("done");}window.onload = loadScript(); </script> </head> <body> <div id="map-canvas" style="width:400px;height:600px;"></div> </body></html></pre>
BRM
<p>PuckPuck your solution worked for me. I still get zillions of blank lines at the bottom of the table but at least I get some output.</p><p> </p><p><span>If I may I have a few of other questions.</span></p><ul class='bbc'><li><span>When I upload the reports to BIRT on Demand I am not seeing anything. I have the Online Maps report library in the same (relative) position in BoD as I do locally. (But I would have thought that the rptlibary elements are simply embedded in the report script and so it doesn't matter). Maybe this is a BoD problem.</span><br />
<br />
</li><li><span>In another iteration of this report I used the geographic centers of the area codes and use circles (bubbles) to display the call volume data. PuckPuck I think you were the one who added this feature to the rptlibrary. Are other shapes possible?</span><br />
</li><li><span>Is there any possibility that BIRT Online Maps could work directly with kml data. I know that lat/lng can be extracted from kml (that is how I got the data that I provided in my first post) but that is a little bit of work.</span><br />
</li><li><span>kclark, how would I use the code that you posted? Does it go in a text element somewhere in the report like the BIRT Online Maps report elements do? I assume that this line "[color=rgb(255,0,0);]<em><span>center[/color]<span>:</span><span> </span><span>new</span><span> google</span><span>.</span><span>maps</span><span>.</span><span>LatLng</span><span>(-</span><span>34.397</span><span>,</span><span> </span><span>150.644</span></em><span><em>)</em></span></span>[color=rgb(102,102,0);]" [/color]<span>contains the point to be located on the map? I am getting the hang of BIRT Online Maps but always interested in other ways of doing things.</span></span><br />
</li></ul><p>Thanks again for your help.</p><p> </p><p>BRM</p>
kclark
<p>BRM -- The code I posted does go in inside of a text element. If you take a look at Google's JavaScript doc you can see there is a bunch of cool stuff you can do in BIRT. I have an example laying around somewhere on my hard drive that I'll post when I find it that grabs lat/long from a data set via the data engine API and then plots makers using that data.</p>
rveeraraghav
<p>Hi All,</p><p> I tried to follow the sample Green index, but in my case the map is rendered with default colors only, just the standard one, not green, yellow and red the way Puck Puck's Green Index example works. What am I missing. I have the pin address and I do an addAddress and also at the time I do an addAddress, I do know what the color of the pin should be. How can I fix it?</p><p>Thanks,</p><p> Ravi</p>
Clement Wong
<blockquote class="ipsBlockquote" data-author="rveeraraghav" data-cid="128865" data-time="1403703000"><div><p>Hi All,</p><p> I tried to follow the sample Green index, but in my case the map is rendered with default colors only, just the standard one, not green, yellow and red the way Puck Puck's Green Index example works. What am I missing. I have the pin address and I do an addAddress and also at the time I do an addAddress, I do know what the color of the pin should be. How can I fix it?</p><p>Thanks,</p><p> Ravi</p></div></blockquote><p> </p><p>Hi Ravi,</p><p> </p><p>The Pin color takes the color of the pin report item. In the Green Index example, you'll notice that the [Pin] Data item has highlights based on various values.</p><p> </p><p>To define a Pin, you'll need to set a Bookmark. Looking at the Green Index example, select the [Pin] Data item and go to its Bookmark. The definition is:</p><pre class="_prettyXprint">"Pin_" + row.__rownum</pre><p>The BIRT Online Maps library searches for an HTML elements with prefix of IDs of "Pin_" when it builds the Google Maps Pins.</p><p> </p><p>So it might be that your design is missing that step.</p>
rveeraraghav
<p>Thanks Clement. I see the issue now and will try and change my report.</p><p>- Ravi</p>
rveeraraghav
<p>Yes, that was it. I had the book mark, but I forgot to highlight the item. It works very well now.</p><p>- Ravi</p>