Is there a way to actually tell OpenLayers not to request tiles out of particular bounds?

I want the rest of map and other layers still accessible, so maxExtent on map is not an option for me. I just want to restrict one WMS layer to particular bounds. If view port is inside the bounds and user zooms in fine, OpenLayers requests new tiles! but if viewport is outside, the WMS should only fill the bounded area with tiles from that WMS layer.

Does that make sense or is that even possible?

2 Answers 2


You should use maxExtent option on layer level.

  • I have already mentioned why i cant use maxExtent
    – Shaunak
    Commented Oct 15, 2012 at 4:27
  • You wrote maxExtent on map but I proposed to use maxExtent not on map but on layer level. maxExtent on map and on layer level are completely different options!
    – drnextgis
    Commented Oct 15, 2012 at 4:43
  • yup, I know, but even if WMS inherits from Layer, setting maxExtent on WMS layer, doesn't stop Openlayers from requesting tiles from out of bounds! If you have tried this option and its working for you, please let me know,becuase then something else ,might be wrong, although thats unlikely.
    – Shaunak
    Commented Oct 15, 2012 at 5:20
  • I've modified my own project. Comapre: demo.nextgis.ru/balakovo/gse.html (with maxExtent option) and demo.nextgis.ru/balakovo (original version).
    – drnextgis
    Commented Oct 15, 2012 at 7:49
  • you were right. maxExtent on layer does work. but only when tiling is enabled. If layer is set to single tile.. it ignores the maxExtent! thats silly! any way to get around this issue?
    – Shaunak
    Commented Oct 17, 2012 at 13:53

If you are bothered by pink, broken image tiles, you can change .olOnImageLoadError css class to { display: none; important! }.

  • Nothing like that. I just want to restrict it.
    – Shaunak
    Commented Oct 15, 2012 at 4:27
  • Issue I am trying to address here is performance. I just dont need the tiles outside of bounds. The layer is vector intensive and WMS takes time to render it. Also Tile Cache is not an option as i am using dynamic SLDs everytime.
    – Shaunak
    Commented Oct 15, 2012 at 5:22
  • Then the other answer has the right suggestion for you i think.
    – U2ros
    Commented Oct 15, 2012 at 6:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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