[OpenLayers-Users] zoomToMaxExtent() not working in IE

Jeffrey Johnson ortelius at gmail.com
Thu Oct 4 19:53:10 EDT 2007


Hi everyone,

I have a somewhat strange TC/OL project going (non spatial images),
and am having some problems in IE.

My js function looks like this ...

function initImage(srcFile, layer_name, image_size)
{
	zoomLevels = "3";
	imageDirPath = "c:/CrystalImages/";
	map = new OpenLayers.Map( $('map'));
	currentLayer = new OpenLayers.Layer.WMS(layer_name,
["http://localhost/cgi-bin/tilecache/crystalnavigator.py?srcFile=" +
srcFile + "&layer_name=" + layer_name + "&tmp_path=" + imageDirPath +
"&zoom_levels=" + zoomLevels + "&image_size=" + image_size,
"http://localhost/cgi-bin/tilecache/crystalnavigator.py?srcFile=" +
srcFile + "&layer_name=" + layer_name + "&tmp_path=" + imageDirPath +
"&zoom_levels=" + zoomLevels + "&image_size=" + image_size],
{'layers':layer_name}, {maxResolution:4, numZoomLevels:zoomLevels,
maxExtent: new OpenLayers.Bounds(0,0,image_size,image_size)});
	map.addLayer(currentLayer);
	map.events.remove('dblclick');
	map.events.remove('mousemove');	
	map.zoomToMaxExtent();
}

crystalnavigator.py calls Tilecache to cut the tiles. The images are
always square (usually 1024x1024).

Anyway, this works great in FF, but in IE (6 or 7). When the page
loads, the map display is blank and I need to hit the zoom to extent
globe twice to get it to actually zoom to max extent. The first time I
click, the image shows up, but is zoomed in and does not fit in the
map div. The second time I click it actually zooms to max extent
properly.

If you were wondering, after the second click, if I zoom in and then
click the zoom to max extent globe, it works fine.

Anyone have any idea what gives?

Thanks

Jeff



More information about the Users mailing list