scaleRange
require(["esri/smartMapping/heuristics/scaleRange"], function(scaleRange) { /* code goes here */ });esri/smartMapping/heuristics/scaleRangeFunction for determining suggested min and max scale ranges for an input layer.
Known Limitations
- Input SceneLayers must meet the following conditions:
- SceneLayers without the
supportsRendererandsupportsLayerQuerycapabilities enabled, unless a predefined statistics object is passed to thestatisticsparameter of the method in conjunction with the layer. To check a SceneLayer's capabilities, use the getFieldInfoUsage() method.
- SceneLayers without the
Moved from esri/renderers/smartMapping/... at 4.16.
Method Overview
| Name | Return Type | Summary | Function | |
|---|---|---|---|---|
| Promise<ScaleRangeResult> | Generates a suggested scale range (i.e. more details | more details | scaleRange |
Method Details
- scaleRange(params){Promise<ScaleRangeResult>}
Generates a suggested scale range (i.e. minScale and maxScale) to apply to the input
layer. These values suggest the best scale range for viewing the input layer.Parameters:Specification:params ObjectSee the table below for details about parameters that may be passed to this function.
Specification:The layer for which to generate a suggested min/max scale range.
view ViewsampleSize NumberoptionalDefault Value: 500The number of features in the
layerto sample for spatial statistics. A higher sample size will yield more precise results. However, higher sample sizes also require more time for the function to process the result.signal AbortSignaloptionalAllows for cancelable requests. If canceled, the promise will be rejected with an error named
AbortError. See also AbortController.Returns:Type Description Promise<ScaleRangeResult> Resolves to an object containing the suggested minandmaxscale for the layer.Example:scaleRange({ layer: featureLayer, view: view }).then(function(response){ // apply the suggested scale range to the input layer featureLayer.minScale = response.minScale; featureLayer.maxScale = response.maxScale; view.map.add(featureLayer); });
Type Definitions
- ScaleRangeResult
Suggested
minandmaxscales to apply to the input layer for the scaleRange() function.