Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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, openlayer 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?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

You should use maxExtent option on layer level.

share|improve this answer
    
I have already mentioned why i cant use maxExtent –  Shaunak Oct 15 '12 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 Oct 15 '12 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 Oct 15 '12 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 Oct 15 '12 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 Oct 17 '12 at 13:53

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

share|improve this answer
    
Nothing like that. I just want to restrict it. –  Shaunak Oct 15 '12 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 Oct 15 '12 at 5:22
    
Then the other answer has the right suggestion for you i think. –  U2ros Oct 15 '12 at 6:33

Your Answer

 
discard

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.