require(["esri/geometry/scaleUtils"], function(scaleUtils) { /* code goes here */ });
Description
(Added at v3.8)
Utility methods to get map scale or extent for a given scale.
When coding legacy (non-AMD) style, there is no need to require the module. All methods and properties are available in the namespace. For example,
esri.geometry.getExtentForScale()
.
Samples
Search for
samples that use this class.
Methods
Method Details
Get the extent for the specified scale.
Parameters:
<Map > map |
Required |
The input map. |
<Number > scale |
Required |
The input scale. |
Sample:
require([
"esri/geometry/scaleUtils", ...
], function(scaleUtils, ... ) {
var extent = scaleUtils.getExtentForScale(map, 10000);
...
});
Gets the current scale of the map.
Parameters:
<Map > map |
Required |
The map whose scale should be calculated. |
Sample:
require([
"esri/geometry/scaleUtils", ...
], function(scaleUtils, ... ) {
var scale = scaleUtils.getScale(map);
...
});
Sample:
require([
"esri/geometry/scaleUtils", ...
], function(scaleUtils, ... ) {
var mapUnit = scaleUtils.getUnitValueForSR(map.spatialReference);
...
});