From 1af11e27ace8ea8c9f2223771f2d932f73c7ce42 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Tue, 29 Oct 2013 09:41:33 -0600 Subject: [PATCH] Proper map extent for GetFeatureInfo request Note that with and without this change, the pixel provided to the ol.source.wms.getFeatureInfo function will be wrong if the view has non-zero rotation. --- src/ol/source/imagewmssource.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/ol/source/imagewmssource.js b/src/ol/source/imagewmssource.js index 5a408687d1..788070fe65 100644 --- a/src/ol/source/imagewmssource.js +++ b/src/ol/source/imagewmssource.js @@ -104,13 +104,11 @@ ol.source.ImageWMS.prototype.getImage = */ ol.source.ImageWMS.prototype.getFeatureInfoForPixel = function(pixel, map, success, opt_error) { - var view2D = map.getView().getView2D(), - projection = view2D.getProjection(), - size = map.getSize(), - bottomLeft = map.getCoordinateFromPixel([0, size[1]]), - topRight = map.getCoordinateFromPixel([size[0], 0]), - extent = [bottomLeft[0], topRight[0], bottomLeft[1], topRight[1]], - url = this.imageUrlFunction(extent, size, projection); + var view = map.getView().getView2D(); + var size = map.getSize(); + goog.asserts.assert(goog.isDefAndNotNull(size)); + var extent = view.calculateExtent(size); + var url = this.imageUrlFunction(extent, size, view.getProjection()); goog.asserts.assert(goog.isDef(url), 'ol.source.ImageWMS#imageUrlFunction does not return a URL'); ol.source.wms.getFeatureInfo(url, pixel, this.getFeatureInfoOptions_, success,