[GIS] Setting default zoom level in OpenLayers

openlayers-2

With your help I was able get a shapefile from the CAD file of the previous question.

Now the next step is the display the shapefile in OpenLayers… I wrote the script but the map being displayed in the browser is way too small… I need help setting the default zoom level…

Can someone point me to an "simple" example that explains how to set the default zoom level?

The ones I've found a way to complicated…

Best Answer

The second argument to map.setCenter is a zoom.

  var map = new OpenLayers.Map("mapdiv");
  // add layers here
  map.setCenter(new OpenLayers.LonLat(yourlon, yourlat), 5);

If you want something more complex than that, you're probably going to need to share more details about what your map and setup currently look like. (Projection, base layer, etc.)