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){
if(mapPanel.map.baseLayer.name=="shapefile")
{
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);?
}
else
{
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",
"/html/pressure_inter.png",
image_bounds,
new OpenLayers.Size(1050 ,800),
{
isBaseLayer: false,
buffer: 0,
transitionEffect: "resize",
}
);
mapPanel.map.layers[1].redraw();
I Am I using moveTo() correctly? Any help would be much appreciated. Thanks a
lot._______________________________________________
Dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-dev