[Users] Problem using Google as base layer...
Paul james
pauljame at gmail.com
Mon Aug 30 17:15:20 CEST 2010
Hello guys...
I´m getting that error when use Google maps as my base layer:
Error: 'null' is null or not an object
Method :
zoomToExtent: function(bounds, closest) {
var center = bounds.getCenterLonLat(); <======== Error, bounds null
My code:
Ext.onReady(function() {
map = new OpenLayers.Map('Map', {
projection:new OpenLayers.Projection("EPSG:900913"),
units: "m",
displayProjection: new OpenLayers.Projection("EPSG:4326"),
tileSize: new OpenLayers.Size(400, 400),
maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34,
20037508.34, 20037508.34),
numZoomLevels: 10
});
viewport = new Ext.Viewport({
forceFit: true,
hideMode: "offsets",
layout: "border",
hideBorders: true,
items: [
{
id: 'page-header-panel',
region: "north",
contentEl: "divMenu",
height: 87
},
{
id: 'page-center',
region: 'center',
layout: 'fit',
frame: false,
border: false,
margins: '5 2 2 0',
items: [CreateMapPanel(map)]
}
]
});
});
CreateMapPanel = function(__map) {
var _mapfile = GetMapFileLocation();
var _google = new OpenLayers.Layer.Google("Google Physical",
{
'type': G_PHYSICAL_MAP,
maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34,
20037508.34, 20037508.34),
'sphericalMercator': true
}
);
//Overlay
var _testOverlay= new OpenLayers.Layer.WMS("TestOverlay",
_mapfile, {
"LAYERS": ['TestOverlay'],
transparent: true,
format: "image/png"
}, {
isBaseLayer: false,
tileSize: new OpenLayers.Size(400,400),
buffer: 0,
visibility: true
});
return new GeoExt.MapPanel({
border: true,
region: "center",
xtype: "gx_mappanel",
tbar: MakeToolBar(__map),
map: __map,
zoom: 1,
layers: [_google,_testOverlay]
});
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20100830/62d96773/attachment.htm
More information about the Users
mailing list