[OpenLayers-Users] Zoom Level and Base Layer problem

Marc Jansen jansen at terrestris.de
Mon Aug 3 17:58:27 EDT 2009


Hi Raul,

just a guess: JavaScript / OpenLayers is case sensitive, so first you 
would need to write:

minExtent: new OpenLayers.Bounds(-75.69927, -4.79079, -75.67719, 4.81273),
maxExtent: new OpenLayers.Bounds(-180,-90,180,90)

Then you could set min- and max extent on the map-object as well, e.g.:

var map = new OpenLayers.Map('map', {
  minExtent: new OpenLayers.Bounds(-75.69927, -4.79079, -75.67719, 4.81273),
  maxExtent: new OpenLayers.Bounds(-180,-90,180,90)
});

Afterwards you could issue:

map.zoomToExtent( map.getMinExtent() );

To zoom to a specific zoom level use
map.zoomTo( yourZoomLevel );

maybe you only need to set the center of the map and an appropriate 
zoomleve like so:
map.setCenter(lonlatObj, zoomlevel);

BTW a map.zoomToMaxExtent would zoom to the extent of whole world.

Regards,

Marc Jansen


Raul David Orozco schrieb:
> Hi. I´m dealing with an issue  and I'm out of ideas right now.
>
> 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.
>
>  Layer = new OpenLayers.Layer.WMS( layer.name,
>                                             
> "http://192.168.1.5:9090/smms/wms.php",
>                                             {'layers': layer.name, 
> format: "image/png"},
>                                             { MinExtent: new 
> OpenLayers.Bounds(-75.69927, -4.79079, -75.67719, 4.81273),
>                                             MaxExtent: new 
> OpenLayers.Bounds(-180,-90,180,90),
>                                              maxResolution: "auto"});
>
> "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.
>
>
> ------------------------------------------------------------------------
>
> ¡Obtén la mejor experiencia en la web!
> Descarga gratis el nuevo Internet Explorer 8
> http://downloads.yahoo.com/ieak8/?l=e1
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>   




More information about the Users mailing list