Merge pull request #6928 from ahocevar/reproj-resolution

Only adjust resolution when center within projection extent
This commit is contained in:
Andreas Hocevar
2017-06-14 16:31:00 +02:00
committed by GitHub
+3 -1
View File
@@ -40,13 +40,15 @@ ol.reproj.calculateSourceResolution = function(sourceProj, targetProj,
// coordinates may be slightly different. We need to reverse-compensate this // coordinates may be slightly different. We need to reverse-compensate this
// in order to achieve optimal results. // in order to achieve optimal results.
var sourceExtent = sourceProj.getExtent();
if (!sourceExtent || ol.extent.containsCoordinate(sourceExtent, sourceCenter)) {
var compensationFactor = var compensationFactor =
ol.proj.getPointResolution(sourceProj, sourceResolution, sourceCenter) / ol.proj.getPointResolution(sourceProj, sourceResolution, sourceCenter) /
sourceResolution; sourceResolution;
if (isFinite(compensationFactor) && compensationFactor > 0) { if (isFinite(compensationFactor) && compensationFactor > 0) {
sourceResolution /= compensationFactor; sourceResolution /= compensationFactor;
} }
}
return sourceResolution; return sourceResolution;
}; };