[OpenLayers-Users] Zoom Level and Base Layer problem
Nicholas Efremov-Kendall
n.e.kendall at gmail.com
Mon Aug 3 18:03:28 EDT 2009
Hi,
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.
best,
N
e.g.
if( ! map.getCenter() ){
sites2.events.register('loadend', sites2,
function(){map.zoomToExtent(sites2.getDataExtent())});
map.setCenter(null, null);
};
}
or
map = new OpenLayers.Map ("map",
{
controls:[
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.PanZoomBar(),
new OpenLayers.Control.LayerSwitcher(),
new OpenLayers.Control.Attribution()],
sphericalMercator: true,
maxExtent: new
OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
maxResolution: 156543.0399,
numZoomLevels: 19,
units: 'm',
projection: new OpenLayers.Projection("EPSG:900913"),
displayProjection: new OpenLayers.Projection("EPSG:4326"),
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)
On Tue, Aug 4, 2009 at 12:41 AM, Raul David Orozco <hagen1113 at yahoo.com>wrote:
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090804/6e76f3cf/attachment.html
More information about the Users
mailing list