[OpenLayers-Dev] Image layer changing bounds

Singco Sabah singcosabah at yahoo.com
Fri Jun 15 02:16:21 PDT 2012

Hello, I need help regarding image layers.

Here's my problem. I have two base layers which is a google map with EPSG:900913 projection and a shapefile with EPSG:4326 projection. Now on top of the base map I have an image overlay in png format. With the default basemap loaded first which is the shapefile, the map loads properly, but when I switch the baselayer into google, the image layer does not display. Switching back to the shapefile base layer, the image layer is visible again. Here's how my code goes:

 mapPanel.map.events.register('changebaselayer', mapPanel.map, function(e){

mapPanel.map.layers[1].extent = new OpenLayers.Bounds(116, 4, 128, 22);
//or this should be mapPanel.map.layers[1].moveTo(new OpenLayers.Bounds(116, 4, 128, 21.61).transform(geographic, mercator), true, true);?
mapPanel.map.layers[1].moveTo(new OpenLayers.Bounds(116, 4, 128, 21.61).transform(geographic, mercator), true, true);
//I also tried mapPanel.map.layers[1].extent = new OpenLayers.Bounds(116, 4, 128, 22).transform(geographic, mercator), true, true);

Here's a code of how I called my layer:
new OpenLayers.Layer.Image
                                "Pressure - Interpolated",
                                new OpenLayers.Size(1050 ,800),
                                      isBaseLayer: false,
                                      buffer: 0,
                                      transitionEffect: "resize",


I Am I using moveTo() correctly? Any help would be much appreciated. Thanks a lot.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20120615/43bbee5a/attachment.html>

More information about the Dev mailing list