[OpenLayers-Users] Question regarding maxResolution

Jeff Dege jeff.dege at korterra.com
Wed Mar 24 15:00:39 EDT 2010


I'm playing around with OpenLayers again, after a pause of a year or so.  I'm trying to see what I can do with the commercial service layers.

Working in 2.8:

I'm looking at two examples, one is the map on the homepage:  http://openlayers.org/
 This map is constructed with the following call:

   var map = new OpenLayers.Map('map', {'maxResolution': 1.40625/2});

I'm also looking at the baselayers example:  http://openlayers.org/dev/examples/baseLayers.html
This map is constructed with the following call:

   map = new OpenLayers.Map( 'map' );

I've stripped this down to just the Virtual Earth layer, and changed the starting location and zoom level:

                var div = document.getElementById('mapdiv');

                var lon = -93;
                var lat = 45;
                var zoom = 9;

//            var map = new OpenLayers.Map(div, { 'maxResolution': 'auto' });
                var map = new OpenLayers.Map(div);

                var ve = new OpenLayers.Layer.VirtualEarth("VE");

                map.addLayers([ve]);

                map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
                map.addControl(new OpenLayers.Control.MousePosition());

The problem is that it doesn't work. The map doesn't draw. If I construct the map with no options, the way it was done in the base layers example. It only works if I pass a maxResolution argument, even if that argument is 'auto'.

I'm trying to understand how this is supposed to be working, and for the life of me I can't get a handle on it.  Why is maxResolution necessary on my page, but not on the baselayers page?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100324/296f3db2/attachment.html


More information about the Users mailing list