Hello guys...<br><br>I´m getting that error when use Google maps as my base layer:<br>Error: 'null' is null or not an object<br><br>Method :<br> zoomToExtent: function(bounds, closest) {<br> var center = bounds.getCenterLonLat(); <======== Error, bounds null<br>
<br><br>My code:<br>Ext.onReady(function() {<br> map = new OpenLayers.Map('Map', { <br> projection:new OpenLayers.Projection("EPSG:900913"),<br> units: "m", <br> displayProjection: new OpenLayers.Projection("EPSG:4326"),<br>
tileSize: new OpenLayers.Size(400, 400),<br> maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34), <br> numZoomLevels: 10<br> }); <br><br><br> viewport = new Ext.Viewport({<br>
forceFit: true,<br> hideMode: "offsets",<br> layout: "border",<br> hideBorders: true,<br> items: [<br> {<br> id: 'page-header-panel',<br>
region: "north",<br> contentEl: "divMenu",<br> height: 87<br> }, <br> {<br> id: 'page-center',<br> region: 'center',<br>
layout: 'fit',<br> frame: false,<br> border: false,<br> margins: '5 2 2 0',<br> items: [CreateMapPanel(map)]<br> }<br>
]<br> });<br><br>});<br><br><br>CreateMapPanel = function(__map) {<br> var _mapfile = GetMapFileLocation(); <br> <br> var _google = new OpenLayers.Layer.Google("Google Physical",<br> {<br>
'type': G_PHYSICAL_MAP,<br> maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34),<br> 'sphericalMercator': true<br> }<br> ); <br>
<br> //Overlay<br> var _testOverlay= new OpenLayers.Layer.WMS("TestOverlay",<br> _mapfile, {<br> "LAYERS": ['TestOverlay'],<br> transparent: true, <br>
format: "image/png"<br> }, {<br> isBaseLayer: false,<br> tileSize: new OpenLayers.Size(400,400),<br> buffer: 0,<br> visibility: true <br>
}); <br> <br> return new GeoExt.MapPanel({<br> border: true,<br> region: "center",<br> xtype: "gx_mappanel",<br> tbar: MakeToolBar(__map),<br> map: __map,<br>
zoom: 1,<br> layers: [_google,_testOverlay]<br> });<br>}<br><br>