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 need to define an layer in OpenLayers just showing world map. The most simpliest variant is to create OSM layer. When I do like this:

var layer = new OpenLayers.Layer.OSM("OSM");

How can I define restrictions/bounds to show the world map?

share|improve this question
up vote 5 down vote accepted

You can add restrictions to whole map and change its later (if necessary), for example:

var map, layer;
function init() {
    map = new OpenLayers.Map('map', {
        maxExtent: [-18924313.432222, -15538711.094146, 18924313.432222, 15538711.094146],
        restrictedExtent: [-13358338.893333, -9608371.5085962, 13358338.893333, 9608371.5085962],
    layer = new OpenLayers.Layer.OSM("Simple OSM Map");

See also:

share|improve this answer

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.