Can we request new OpenLayers WMS image for an extent without moving the map center ?
Reading OpenLayers code, OpenLayers move map center to new extent, and THEN do HTTP request to get the image.
Is it possible to instruct the map to HTTP load certain extent and when 'tileloaded' is fired, THEN load new WMS image?
Edit ----------------------
The problem is I need to "tell the map to zoomToExtent" so it gets a new bound.
OpenLayers Map sets its center and zoom first, and then request new map through HTTP.
The map response will be available in 2 seconds, until that time, map view is blank (if new bound is outside current bound).
if( result.zoom ) {
var bounds = result.data.map.mapBounds;
var x1 = parseFloat( bounds.x1 );
var x2 = parseFloat( bounds.x2 );
var y1 = parseFloat( bounds.y1 );
var y2 = parseFloat( bounds.y2 );
map.zoomToExtent([x1, y1, x2, y2]);
}What i think i need is fetchWmsBound() below.
if( result.zoom ) {
var bounds = result.data.map.mapBounds;
var x1 = parseFloat( bounds.x1 );
var x2 = parseFloat( bounds.x2 );
var y1 = parseFloat( bounds.y1 );
var y2 = parseFloat( bounds.y2 );
function wmsLoaded() {
map.redraw(true);
}
//
// @param {} bounds,
// @param { Function } callback to exec when wms is fetched
// fetchWmsBound might trigger a 'fetched' event also
map.wmslayer.fetchWmsBound( [x1, y1, x2, y2], wmsLoaded );
}
Filed at https://github.com/openlayers/openlayers/issues/573
No comments:
Post a Comment