import scaleRange from "@arcgis/core/smartMapping/heuristics/scaleRange.js";const scaleRange = await $arcgis.import("@arcgis/core/smartMapping/heuristics/scaleRange.js");- Since
- ArcGIS Maps SDK for JavaScript 4.12
Function 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 SceneLayer.getFieldUsageInfo() method.
Functions
| Name | Return Type | Object |
|---|---|---|
| |
scaleRange
Function
Generates a suggested scale range (i.e. FeatureLayer.minScale
and FeatureLayer.maxScale) to apply to the input layer. These
values suggest the best scale range for viewing the input layer.
- Signature
-
scaleRange (parameters: ScaleRangeParameters): Promise<ScaleRangeResult>
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| parameters | The function parameters. | |
- Returns
- 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);});