<div>Hi,<br></div><div></div><div>You can either specify the zoom level in your map options and drop the zoomtomaxextent, or once you've loaded data, you a map.centerfunction set on whatever data you load.</div><div>best,</div>
<div>N</div><div></div><div>e.g.</div><div>         if( ! map.getCenter() ){<br>                 sites2.events.register('loadend', sites2, function(){map.zoomToExtent(sites2.getDataExtent())});<br>                 map.setCenter(null, null);<br>                 };<br>
}<br>or <br></div><div>map = new OpenLayers.Map ("map", <br>                                 {<br>                                 controls:[<br>                                 new OpenLayers.Control.Navigation(),<br>                                 new OpenLayers.Control.PanZoomBar(),<br>                                 new OpenLayers.Control.LayerSwitcher(),<br>
                                new OpenLayers.Control.Attribution()],<br>                         sphericalMercator: true,<br>                         maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),<br>                         maxResolution: 156543.0399,<br>                         numZoomLevels: 19,<br>
</div><div>                         units: 'm',<br>                         projection: new OpenLayers.Projection("EPSG:900913"),<br>                         displayProjection: new OpenLayers.Projection("EPSG:4326"),<br><br></div><div>and then specify a specific lon-lat for your map center, and a zoom level in your variables (e.g var zoom = 2, var lat=x var lon=y) and then map.setCenter(lon, lat, zoom)</div>
<br><div class="gmail_quote">On Tue, Aug 4, 2009 at 12:41 AM, Raul David Orozco <span dir="ltr"><<a href="mailto:hagen1113@yahoo.com">hagen1113@yahoo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<table cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top" style="font:inherit">Hi. I´m dealing with an issue and I'm out of ideas right now.<br><br>I've a layer created in my own WMS server, this layer is built with data from some part of my city of residence, but when I load the layer with OL, the zoom level is very far away, because of that my map looks like a tiny black dot, so I have to do zoom a lot of times to actually see something. I need to know how to set the initial zoom level. Here's the code I'm using to create the Layer.<br>
<br> Layer = new OpenLayers.Layer.WMS( <a href="http://layer.name" target="_blank">layer.name</a>, <br> "<a href="http://192.168.1.5:9090/smms/wms.php" target="_blank">http://192.168.1.5:9090/smms/wms.php</a>",
<br> {'layers': <a href="http://layer.name" target="_blank">layer.name</a>, format: "image/png"},<br> { MinExtent: new OpenLayers.Bounds(-75.69927, -4.79079, -75.67719, 4.81273),<br>
MaxExtent: new OpenLayers.Bounds(-180,-90,180,90),
<br> maxResolution: "auto"});<br><br>"This coordinates (-75.69927, -4.79079, -75.67719, 4.81273) contain inside all the graphic I want to show in the initial zoom level ". I used ZoomtoMaExtent but I get an error of "bounds is null". Thanks.<br>
</td></tr></tbody></table><div class="hm"><br>
<hr size="1"><br><font face="Verdana" size="-2">¡Obtén la mejor experiencia en la web!<br>Descarga gratis el nuevo Internet Explorer 8<br>
<a href="http://downloads.yahoo.com/ieak8/?l=e1" target="_blank">http://downloads.yahoo.com/ieak8/?l=e1</a></font></div><br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@openlayers.org">Users@openlayers.org</a><br>
<a href="http://openlayers.org/mailman/listinfo/users" target="_blank">http://openlayers.org/mailman/listinfo/users</a><br>
<br></blockquote></div><br>