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.
This commit is contained in:
@@ -104,13 +104,11 @@ ol.source.ImageWMS.prototype.getImage =
|
|||||||
*/
|
*/
|
||||||
ol.source.ImageWMS.prototype.getFeatureInfoForPixel =
|
ol.source.ImageWMS.prototype.getFeatureInfoForPixel =
|
||||||
function(pixel, map, success, opt_error) {
|
function(pixel, map, success, opt_error) {
|
||||||
var view2D = map.getView().getView2D(),
|
var view = map.getView().getView2D();
|
||||||
projection = view2D.getProjection(),
|
var size = map.getSize();
|
||||||
size = map.getSize(),
|
goog.asserts.assert(goog.isDefAndNotNull(size));
|
||||||
bottomLeft = map.getCoordinateFromPixel([0, size[1]]),
|
var extent = view.calculateExtent(size);
|
||||||
topRight = map.getCoordinateFromPixel([size[0], 0]),
|
var url = this.imageUrlFunction(extent, size, view.getProjection());
|
||||||
extent = [bottomLeft[0], topRight[0], bottomLeft[1], topRight[1]],
|
|
||||||
url = this.imageUrlFunction(extent, size, projection);
|
|
||||||
goog.asserts.assert(goog.isDef(url),
|
goog.asserts.assert(goog.isDef(url),
|
||||||
'ol.source.ImageWMS#imageUrlFunction does not return a URL');
|
'ol.source.ImageWMS#imageUrlFunction does not return a URL');
|
||||||
ol.source.wms.getFeatureInfo(url, pixel, this.getFeatureInfoOptions_, success,
|
ol.source.wms.getFeatureInfo(url, pixel, this.getFeatureInfoOptions_, success,
|
||||||
|
|||||||
Reference in New Issue
Block a user