Fix #7304: Re-calculate the resolution when the WMS source is reprojected

This commit is contained in:
Kogis IWI
2017-10-03 17:21:36 +02:00
parent 2e16d04bbe
commit 232f56e229
4 changed files with 99 additions and 12 deletions
+9 -1
View File
@@ -10,6 +10,7 @@ goog.require('ol.events.EventType');
goog.require('ol.extent');
goog.require('ol.obj');
goog.require('ol.proj');
goog.require('ol.reproj');
goog.require('ol.source.Image');
goog.require('ol.source.WMSServerType');
goog.require('ol.string');
@@ -136,6 +137,13 @@ ol.source.ImageWMS.prototype.getGetFeatureInfoUrl = function(coordinate, resolut
if (this.url_ === undefined) {
return undefined;
}
var projectionObj = ol.proj.get(projection);
var sourceProjectionObj = this.getProjection();
if (sourceProjectionObj && sourceProjectionObj !== projectionObj) {
resolution = ol.reproj.calculateSourceResolution(sourceProjectionObj, projectionObj, coordinate, resolution);
coordinate = ol.proj.transform(coordinate, projectionObj, sourceProjectionObj);
}
var extent = ol.extent.getForViewAndSize(
coordinate, resolution, 0,
@@ -158,7 +166,7 @@ ol.source.ImageWMS.prototype.getGetFeatureInfoUrl = function(coordinate, resolut
return this.getRequestUrl_(
extent, ol.source.ImageWMS.GETFEATUREINFO_IMAGE_SIZE_,
1, ol.proj.get(projection), baseParams);
1, sourceProjectionObj || projectionObj, baseParams);
};