Export method to get resolution for extent and size
While this is straightforward to calculate, this method adds convenience.
This commit is contained in:
@@ -287,9 +287,12 @@ goog.exportProperty(
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get the resolution for a provided extent (in map units) and size (in pixels).
|
||||||
* @param {ol.Extent} extent Extent.
|
* @param {ol.Extent} extent Extent.
|
||||||
* @param {ol.Size} size Box pixel size.
|
* @param {ol.Size} size Box pixel size.
|
||||||
* @return {number} Resolution.
|
* @return {number} The resolution at which the provided extent will render at
|
||||||
|
* the given size.
|
||||||
|
* @todo api
|
||||||
*/
|
*/
|
||||||
ol.View2D.prototype.getResolutionForExtent = function(extent, size) {
|
ol.View2D.prototype.getResolutionForExtent = function(extent, size) {
|
||||||
var xResolution = ol.extent.getWidth(extent) / size[0];
|
var xResolution = ol.extent.getWidth(extent) / size[0];
|
||||||
|
|||||||
Reference in New Issue
Block a user