<span class="gI">Hi all,<br>I have been trying for a long time to accomplish something which should be simple but it seems today it's not my day. <br>I just want to zoom my map to a BBOX value that I am getting from Postgis in order to present a certain feature so I am using map.zoomToExtent(new OpenLayers.Bounds(533052, 22268, 533052, 22268)); in the following way but no zoom is being made.. map is being displayed at its maxim extent as defined.. does anyone have a clue?<br>
Thanks!<br><br>function makeMap() {<br> <br> var maximExtent = new OpenLayers.Bounds(521500,15000,556500,40000); //andorra<br> var resolutions = [68.359375,34.1796875,17.08984375,8.544921875,4.2724609375,2.13623046875,1.068115234375]; <br>
var genericMapOptions = {<br> maxExtent: new OpenLayers.Bounds(521500, 15000, 556500, 40000),<br> maxResolution: 'auto',<br> units: 'meters',<br> projection: 'EPSG:27573'<br>
}<br> var overviewMapSize = new OpenLayers.Size(128, 123);<br> var url = "<a href="http://xxxxx/tilecache.py">http://xxxxx/tilecache.py</a>?";<br> var urlNoCache = "<a href="http://xxxxxx">http://xxxxxx</a>";<br>
<br> var geoLayers = ['corbes_5', 'corbes_25', 'corbes_100', 'carreteres', 'rius', 'limit_pais', 'edificis']<br><br> var orto_andorra = new OpenLayers.Layer.WMS("Ortofoto", "<a href="http://www.ideandorra.ad/wmsorto2003/request.aspx">http://www.ideandorra.ad/wmsorto2003/request.aspx</a>?", {layers: "masaic_5m"},{isBaseLayer: true, resolutions: resolutions, transitionEffect:'resize'} )<br>
<br> var molleres = new OpenLayers.Layer.WMS("molleres", urlNoCache, {layers: "molleres",transparent:"true"},{resolutions: resolutions, transitionEffect:'resize'} )<br><br> var geografia = new OpenLayers.Layer.WMS("geografia", urlNoCache, {layers: geoLayers,transparent:"true"},{resolutions: resolutions, transitionEffect:'resize'} )<br>
<br> var layers = [orto_andorra,molleres,geografia];<br><br> var mapControls = [<br> new OpenLayers.Control.Navigation(),<br> new OpenLayers.Control.PanZoomBar(),<br> new OpenLayers.Control.MousePosition()<br>
];<br><br> <br> var mapOptions = OpenLayers.Util.extend({<br> resolutions: resolutions,<br> controls: mapControls,<br> restrictedExtent: maximExtent<br> }, genericMapOptions);<br>
<br><br><br> map = new OpenLayers.Map("mapa", mapOptions);<br> map.addLayers(layers);<br> <br> map.zoomToExtent(new OpenLayers.Bounds(533052, 22268, 533052, 22268));<br><br><br> return map;<br>}<br>
<br><br><br></span>