hi,

i am trying to calculate center and zoom levels dynamically based on
the polygon points which i have added on the google map. below is the
code which i am using to calculate the center and zoom locations:

//empty GLatLngBounds object
var bounds = new GLatLngBounds();
....
....
//adding polygon to the google map
//plotArea is custom object, createPolygon(obj) to crate a polygon
object
poly = createPloygon(plotArea);
map.addOverlay(poly);
//calling the extendBounds function to extend points
extendBounds(bounds, plotArea.boundaryArray);
....
....
//function to extend the multiple boundary points
function extendBounds(bounds, boundaryArray) {
        if(boundaryArray != null && boundaryArray.length > 0) {
                for(var i = 0; i < boundaryArray.length; i++) {
                        bounds.extend(boundaryArray[i]);
                }
        }
}

//function createPolygon to create the polygon
function createPolygon(plotArea) {
        var poly = null;
        if(plotArea != null && plotArea.boundaryArray != null &&
plotArea.boundaryArray.length > 0) {
                var color = '#ff0000';
                if(plotArea.growth != null && parseFloat(plotArea.growth) > 
0.0) {
                        color = '#00ff00';
                }
                poly = new GPolygon(plotArea.boundaryArray, color, 1, 1, color, 
0.2,
{ clickable:false });
        }

        return poly;
}

and finally i am calling below steps to set the center and zoom level:

map.setCenter(bounds.getCenter());
map.setZoom(map.getBoundsZoomLevel(bounds));

This code is deployed on BEA9.2 server, when i check the page it is
giving me correct results. But when i integrate my Google Map page on
Cognos Report [cognos report runs on cognos server and my application
runs on bea weblogic server] i am not getting the result consistently,
some times i get correct result and some times i get Zoom level '0'
and center location as '0,0'.

my question is, am i hitting the problem from Google Map or from the
Cognos Server?? or
does bounds.getCenter(), map.getBoundsZoomLevel(bounds) methods are
not compatable in this case?? can any one help me in this plz??

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to