[OpenLayers-Users] PanZoomBar

Erik Uzureau euzuro at gmail.com
Mon Aug 28 23:53:55 CDT 2006


Hi Richie,

The little thing being overlooked is that you need to set the
maxResolution option to "auto".

If you change your map definition to

var bounds = new OpenLayers.Bounds(-94.8, 32.3, -89.6, 36.9);
var map = new OpenLayers.Map('map', {maxExtent: bounds, maxResolution:
"auto", maxZoomLevel: 8, controls: []  });

then I think it should work.

It is also worthy of mention that the use of 'maxZoomLevel' parameter
with standard
wms layers, etc, is soon to be deprecated, in favor of the more
reasonable-sounding
'numZoomLevels'.

For a full explanation, see: http://trac.openlayers.org/wiki/SettingZoomLevels

--Erik

On 8/28/06, Richie Pierce <Richie.Pierce at arkansas.gov> wrote:
>
>
>
>
> I'm trying to define a custom extent and zoom levels for my interface.  The
> maxExtent parameter seems to be working fine but the maxZoomLevel doesn't
> seem to be working.  When the map loads, it is loading to the extent I
> define.  But the PanZoomBar is still showing the standard 16 levels of zoom
> and the max zoom level on the bar is outside of my defined maxExtent.
>
>
>
> Here's my call for a new map:
>
>
>
>             var bounds = new OpenLayers.Bounds(-94.8, 32.3, -89.6, 36.9);
>
>             var map = new OpenLayers.Map('map', {maxExtent: bounds,
> maxZoomLevel: 8, controls: []  });
>
>
>
> Then I add PanZoomBar / MouseToolbar and LayerSwitcher controls:
>
>
>
>             map.addControl(new OpenLayers.Control.PanZoomBar());
>
>             map.addControl(new OpenLayers.Control.MouseToolbar());
>
>             var LayerSwitcher = new
> OpenLayers.Control.LayerSwitcher();
>
>
>
>
>
> I'm sure I'm missing something, any help would be great.  Thanks
>
>
>
> Richie Pierce
>
> GIS Specialist
>
> Arkansas Geographic Information Office
>
> (w)501-682-2937
>
> (c)501-416-2267
>
> www.gis.state.ar.us
>
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://mailman-viper.python-hosting.com/listinfo/users
>
>
>


More information about the Users mailing list