Search code examples
google-maps-api-3google-maps-api-2

Google maps Api Version 2 to Google maps Api Version 3


I was using the following code to find the center and zoom in my code which was using google maps api V2.

function calculaCentro(points){
alert("in calcula Centro");
    var gbounds = new GBounds(points);
    alert("gbounds is" +gbounds);
    var center = gbounds.mid();
    return center;
}


function calculaZoom(points){
alert("in calcula zoom");
    var gbounds = new GBounds(points);
    var n = new GLatLng(gbounds.min().y,gbounds.min().x);
    var s = new GLatLng(gbounds.max().y,gbounds.max().x);
    var zoom = map.getBoundsZoomLevel(new GLatLngBounds(n,s));
    return zoom;
}

Now I want to convert it to google maps Api V3.But couldnt find any exact replacement for GBounds.Can anyone please help me?


Solution

  • What you want instead is LatLngBounds

    https://developers.google.com/maps/documentation/javascript/reference#LatLngBounds