[OpenLayers-Users] map property horror!
    Robert Buckley 
    robertdbuckley at yahoo.com
       
    Mon Jul 18 16:36:33 EDT 2011
    
    
  
Hi,
I´ve been trying to set variables for the intitial state of a map and am having 
real problems understanding which variables affect which properties and where 
they should be set.
My problem lies firstly with the fact that I don´t know how to calculate the map 
resolution. Also what is the relationship between maxResolution, maxExtent, 
restricted extent and setting a mapcenter?
here are my qustions...
1. My baselayer is mapnik so I´m using a spherical mercator projection. All the 
examples I have seen use "maxResolution: 156543.0339"...but what is that 
actually doing?
2. I want to restrict the extent so that users can´t pan out of my area of 
interest ...therefore I have used "restrictedExtent: new 
OpenLayers.Bounds(847533.769522, 6676621.545731, 1559315.376786, 
7025785.890876),"
3. my maxExtent is set to "maxExtent: new OpenLayers.Bounds(-20037508, 
-20037508,20037508, 20037508),"..otherwise I have found my wms layer isn´t 
shown...but what is the real definition of this property?
4. If I want to setcenter, which of these property need to be taken away? I 
could see that in order the setcenter, the restrictedExtents might need to be 
removed..but is there a "best practice" way of doing these things?
It would be great to get some user help, because the documentation is mostly 
pretty uncomprehensible for people who don´t spend all day programming 
openlayers.
thanks,
my code...
var map = new OpenLayers.Map("map",{
projection:epsg3857,
        displayProjection: epsg4326,
        units: "m",
numZoomLevels: 21,
maxResolution: 156543.0339,
restrictedExtent: new OpenLayers.Bounds(847533.769522, 6676621.545731, 
1559315.376786, 7025785.890876),
maxExtent: new OpenLayers.Bounds(-20037508, -20037508,20037508, 20037508),
        controls: [new OpenLayers.Control.MouseDefaults()
,new OpenLayers.Control.PanZoomBar()
,new OpenLayers.Control.MousePosition()
,new OpenLayers.Control.ScaleLine({geodesic: true})]
    });
var mapnik = new OpenLayers.Layer.OSM();
map.addLayer(mapnik);
var proj = new OpenLayers.Projection("EPSG:4326");
Rob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110718/46e1d286/attachment.html
    
    
More information about the Users
mailing list