Thank you all for your help, I used zoomToExtent and it worked great...
Kenneth Skovhede, GEOGRAF A/S wrote: > There is a function just for that: > http://dev.openlayers.org/releases/OpenLayers-2.8/doc/apidocs/files/OpenLayers/Map-js.html#OpenLayers.Map.zoomToExtent > > > > If you need the value, you can call this: > http://dev.openlayers.org/releases/OpenLayers-2.8/doc/apidocs/files/OpenLayers/Map-js.html#OpenLayers.Map.getZoomForExtent > > > > You can examine the code if you are interested in the inner workings > of calculating a zoom level from a rectangle. > > Regards, Kenneth Skovhede, GEOGRAF A/S > > > > > Adrian Popa skrev: >> Hello everybody. >> >> I'm trying to zoom to view an area for which I have the minimum and >> maximum longitude/latitude. Basically I would like to zoom in to see >> a rectangle with known coordinates. I already calculated the center >> of this rectangle - so that's not a problem - the map centers >> beautifully to that. >> >> The problem is: I have to find out which minimum zoom setting would >> allow my area to be fully visible - so I need to choose a zoom >> setting. There must be a relationship between the difference in >> longitude (or latitude) to a zoom level. >> >> I wonder if anyone knows this relationship - or should I determine it >> empirically. >> >> Thank you. >> >> By the way, my map is using spherical mercator projection, but my >> coordinates are in longitude/latitude (although there is no problem >> in converting them...). >> >> > _______________________________________________ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users