[OpenLayers-Users] Static images, bounds and zoom

Florian Klumb Florian.Klumb at rwth-aachen.de
Wed Dec 10 15:07:15 EST 2008


Hi,

I'm using OpenLayers to develop a viewing application for medical images. So far I'm just using static images, i.e. I'm using the Image layer, and I'm a bit puzzled as to the interdependence of bounds, extent, resolution and all this stuff. I simply want to fit an image which might be quite high-res into the viewport for a start and then let the users zoom in until the natural resolution of the image is reached. I played with all the parameters but to be honest I still haven't quite gotten the gist, so even after hours it seems as if I'm not a step further. A hint or short explanation as to how to approach this would be greatly appreciated!

My code is something like this:
var oMapWest = new OpenLayers.Map('viewportWest');
var graphic = new OpenLayers.Layer.Image(
  'City Lights',
  'images/political_world_map.jpg',  // which is 8000x4000pxs
  new OpenLayers.Bounds(-180, -90, 180, 90),
  new OpenLayers.Size(700, 350),
  {numZoomLevels:10}
);
oMapWest.addLayers([graphic]);
oMapWest.zoomToMaxExtent();

Thanks!

Flo 



More information about the Users mailing list