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.

I'm using openlayers to overlay a raster. When I zoom out, the overlaid layer expands to cover a larger area than was originally requested. I want the tile to be fixed to a particular boundary, and for the WMS query to end, once the zoom changes. When I get the WMS layer the first time, it looks like this:

enter image description here

However, if I zoom out the screen then looks like this:

enter image description here

My javascript is as follows:

wms_url = 'mysite.com/mapserv.cgi?map=population.map&ny_pop';

oldRaster = new OpenLayers.Layer.WMS( 
               "pop_raster",
               wms_url, 
               {    layers: wms_layer, 
                    transparent: true
                    },
               {    maxExtent: polyBounds, 
                    displayOutsideMaxExtent: false,
                    tileSize: new OpenLayers.Size(tileWidth, tileHeight),                   
                    opacity: 0.3, 
                    gutter: 0
                    }   
           );
           map.addLayer(oldRaster);

I've tried adding the attribute persist: false but it does not change anything. I calculate polyBounds using the screen size, and then tileHeight and tileWidth based on the screen resolution so that one tile fills the box that is drawn on-screen.

When I inspect the GET command using HTTPFox the page seems to be actively pulling down more data from the WMS, but I'm not sure why as there are no fresh requests.

share|improve this question
add comment

1 Answer

Try appending this to wms_url : &BBOX=-97.105,24.913,78.794,36.358 but replace the values in this order: minimum longitude, minimum latitude, maximum longitude, maximum latitude.

Make sure the Bounding Box area overlaps with the BoundingBox advertised in the Capabilities XML for the requested geodata object.

Your not using a BBox Strategy anywhere else in your code? This would cause it to make new calls to the server.

share|improve this answer
    
hmm. Thanks for the suggestion. I tried that but am now just getting a blank tile. My wms_url is: http://site.com/mapserv.cgi?map=population.map& new_york_pop&BBOX=-8239644,4974211,-8230593,4979952& I tried both with and without the & at the end. –  djq Apr 11 '12 at 17:49
    
Thanks can you give me the values for polyBounds and wms_layer so i can test? –  CaptDragon Apr 11 '12 at 17:56
    
Thanks CaptDragon - here they are: Polybounds (left, right, bottom, top): -8239644 -8230593 4974211 4979952, wms_url: http://urbmet.webfactional.com/mapserv.cgi?map=population.map&, wms_layer: new_york_pop –  djq Apr 11 '12 at 18:06
    
Thanks... I'll test a bit and post back. –  CaptDragon Apr 11 '12 at 18:13
    
Strange thing is if you make the tiles really small like: tileSize:new OpenLayers.Size(10,10), then it will work but it takes for ever to load. If you increase the size it increases the size of the bounds error margin. –  CaptDragon Apr 11 '12 at 19:11
show 3 more comments

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.