I've just started exploring GeoExt. It displays all the map controls, Google Logo and "Terms of Use". But the map is not rendered. I'm using firebug, and no JavaScript errors are generated. I'm using ext 3.4, OpenLayers 2.11, and GeoExt 1.1.
<link rel="stylesheet" type="text/css" href="libs/ext/resources/css/ext-all.css">
<script type="text/javascript" src="libs/ext/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="libs/ext/ext-all.js"></script>
<script src="libs/openlayers/lib/OpenLayers.js"></script>
<script type="text/javascript" src="libs/geoext/lib/GeoExt.js"></script>
<script src="http://maps.google.com/maps/api/js?sensor=false"
type="text/javascript"></script>
<script type="text/javascript">
Ext.BLANK_IMAGE_URL = "ext/resources/images/default/s.gif";
var app, items = [], controls = [];
Ext.onReady(function() {
app = new Ext.Viewport({
layout: "border",
items: items
});
});
items.push({
xtype: "gx_mappanel",
ref: "mapPanel",
region: "center",
map: {
numZoomLevels: 20,
controls: controls
},
extent: OpenLayers.Bounds.fromArray([
-122.911, 42.291,
-122.787,42.398
]),
layers: [new OpenLayers.Layer.Google(
'Google Streets',
{isBaseLayer: true}
)]
});
controls.push(
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.Attribution(),
new OpenLayers.Control.PanPanel(),
new OpenLayers.Control.ZoomPanel()
);
</script>
</head>
<body>
</body>
Any assistance will be appreciated.
Best Answer
Following the tutorials and source code at http://www.geoext.org/examples.html#examples, I was able to get a Google Map working. My working code is shown below. Any further advice are still welcome. I guess I was using an outdated syntax.
There is a
<div id="mappanel"></div>
in the<body></body>
section.