Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am seeing one weird thing in Openlayers today. I am unable to see whole map by using panzoombar, previously i used to.

  <title>OpenLayers Example</title>
    <script src=""></script>
      <div style="width:100%; height:100%" id="map"></div>
      <script defer="defer" type="text/javascript">
       var  Geographic  = new OpenLayers.Projection("EPSG:4326"); 
       var  Mercator = new OpenLayers.Projection("EPSG:900913");

       var map = new OpenLayers.Map({
           div: "map",
           projection: Mercator,
           displayProjection: Geographic,
           center: new OpenLayers.LonLat(0, 0),
           minResolution: "auto",
           minExtent: new OpenLayers.Bounds(-1, -1, 1, 1),
           maxResolution: "auto",
           maxExtent: new OpenLayers.Bounds(-180, -90, 180, 90),
           units : 'km'


       var layerOSM = new OpenLayers.Layer.OSM();
       map.addControl(new OpenLayers.Control.LayerSwitcher());
       map.setCenter(new OpenLayers.LonLat(0, 0), 1);
       map.addControl(new OpenLayers.Control.PanZoomBar());



this is the code, panzoombar is showing all the levels, but it stopped at last above two levels and not coming down.

share|improve this question
Whats the problem. Is it the Openlayers problem? – Ramesh Kotha Jul 17 '12 at 23:00
Does this happen in other browsers? Is your browser zoomed in too far? Try pressing ctrl+0 – nagytech Jul 19 '12 at 8:56
Yes it is happening in all browsers – Ramesh Kotha Jul 19 '12 at 12:33
up vote 1 down vote accepted

i think this is all about div size. openlayers automatically makes its minimum zoom level to fit it to whole world map... and this does not seem as a problem.

it makes people that "you can see the whole world at this zoom level and i dont want you to see blank images with decreasing the level of zoom."

when width and height is 100% or 600px,400px:

it makes automatically min zoom level to : 3


when width: 200px and height: 400px :

it makes automatically min zoom level to : 1

enter image description here

you can test it with changing the div width and height...

i hope it helps you...

share|improve this answer
Thank you very much @Aragon, But i want to show the map with width 100% and height 100%. How can i do it. – Ramesh Kotha Jul 19 '12 at 8:23
this is not a problem if you think so use OpenLayers 2.10 library. Dont forget to add missing libraries as OpenLayers.Projection. if not you can get OpenLayers.X is not a constructor... – Aragon Jul 19 '12 at 8:26
the url is broken? – Ramesh Kotha Jul 19 '12 at 8:27
ok i have fixed the missing url link... – Aragon Jul 19 '12 at 8:31
thanks you very much... – Ramesh Kotha Jul 19 '12 at 8:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.