[Users] Google Layer in Mappanel
Christopher Schmidt
crschmidt at crschmidt.net
Tue Feb 9 21:56:47 CET 2010
On Tue, Feb 09, 2010 at 09:52:15PM +0100, Jacolin wrote:
> Le mardi 9 février 2010 21:32:35, Christopher Schmidt a écrit :
> > On Tue, Feb 09, 2010 at 09:25:36PM +0100, Jacolin wrote:
> > > Hi,
> > >
> > > I am testing GeoExt with a Google Layer. I copy-pasted the mappanel
> > > example and changed the layer constructor to ues a Google Layer.
> > >
> > > Unfortunately, it doesn't work, I can't pan the map, see
> > > http://softlibre.free.fr/geoext/test.php for an example.
> >
> > That map is pannable.
> >
> > > What is wrong?
> >
> > Perhaps cache.
> >
> > Regards,
> >
> You are right, it is working in chrome, not in my Firefox :/ even after
> disabling cache.
Ah. Chrome is broken, then. I'm using webkit, so presumably that is
similarly broken.
The problem here is that your map has a maxExtent that is tiny:
>>> mapPanel.map.baseLayer.maxExtent.toBBOX()
"-180,-90,180,90"
in projected units, that's just 400m across.
So, if we read the OL docs, we see we need:
var map = new OpenLayers.Map('map');
var layer = new OpenLayers.Layer.VirtualEarth("Virtual Earth",
{
sphericalMercator: true,
maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34)
});
map.addLayer(layer);
map.zoomToMaxExtent();
-- http://docs.openlayers.org/library/spherical_mercator.html
Set a map maxExtent, and you should be good, I expect.
> I will try again tomorrow. thanks,
>
> Y.
> --
> Yves Jacolin
--
Christopher Schmidt
Web Developer
More information about the Users
mailing list