Skip to content
import ScaleRanges from "@arcgis/core/widgets/ScaleRangeSlider/ScaleRanges.js";
Inheritance:
ScaleRangesAccessor
Since
ArcGIS Maps SDK for JavaScript 4.13

The ScaleRanges class represents the ranges of scales for the ScaleRangeSlider widget.

See also

Constructors

Constructor

Constructor
Parameters
ParameterTypeDescriptionRequired
properties
See the properties table for a list of all the properties that may be passed into the constructor.

Properties

Any properties can be set, retrieved or listened to. See the Watch for changes topic.
PropertyTypeClass
RecommendedScales
readonly static
declaredClass
readonly inherited

RecommendedScales

readonlystatic Property
Type
RecommendedScales

The recommended scales at each of the named scale ranges.

declaredClass

readonlyinherited Property
Type
string
Inherited from: Accessor

The name of the class. The declared class name is formatted as esri.folder.className.

Methods

MethodSignatureClass
fromScaleRange(scaleRange: ScaleRange): ScaleRanges
clampScale(scale: number): number
contains(scale: number): boolean
findScaleRangeByIndex(index: number): NamedScaleRange
isMaxScaleEdge(scale: number): boolean
isMinScaleEdge(scale: number): boolean

fromScaleRange

static Method
Signature
fromScaleRange (scaleRange: ScaleRange): ScaleRanges

Helper to create a ScaleRanges object from a minimum and maximum scale.

Parameters
ParameterTypeDescriptionRequired
scaleRange

The scale range.

Returns
ScaleRanges

The scale ranges.

clampScale

Method
Signature
clampScale (scale: number): number

Clamps the scale to the closest minScale or maxScale on the scale range. If the provided scale goes beyond the allowed range, it snaps back to the clamped value.

Parameters
ParameterTypeDescriptionRequired
scale

The scale value from the slider.

Returns
number

The scale number to which the slider will clamp.

contains

Method
Signature
contains (scale: number): boolean

Determines whether the given scale is within the current scale range.

Parameters
ParameterTypeDescriptionRequired
scale

The scale value.

Returns
boolean

If true, the scale is contained within the range.

findScaleRangeByIndex

Method
Signature
findScaleRangeByIndex (index: number): NamedScaleRange

Finds the scale range name at a given index.

Parameters
ParameterTypeDescriptionRequired
index

The index of the scale.

Returns
NamedScaleRange

The named scale range for the given index.

isMaxScaleEdge

Method
Signature
isMaxScaleEdge (scale: number): boolean

Determines if the input scale value can be considered to be at the smallest scale range edge.

Parameters
ParameterTypeDescriptionRequired
scale

The scale value to test against the scale range.

Returns
boolean

If true, the input scale value is considered to be at the smallest scale range.

isMinScaleEdge

Method
Signature
isMinScaleEdge (scale: number): boolean

Determines if the input scale value can be considered to be at the largest scale range edge.

Parameters
ParameterTypeDescriptionRequired
scale

The scale value to test against the scale range.

Returns
boolean

If true, the input scale value is considered to be at the largest scale range.

Type definitions

RecommendedScales

Type definition

Lists the recommended scales for each named scale range.

world

Property
Type
147914382

continent

Property
Type
50000000
Default value
50000000

countriesBig

Property
Type
25000000
Default value
25000000

countriesSmall

Property
Type
12000000
Default value
12000000

statesProvinces

Property
Type
6000000
Default value
6000000

stateProvince

Property
Type
3000000
Default value
3000000

counties

Property
Type
1500000
Default value
1500000

county

Property
Type
750000
Default value
750000

metropolitanArea

Property
Type
320000
Default value
320000

cities

Property
Type
160000
Default value
160000

city

Property
Type
80000
Default value
80000

town

Property
Type
40000
Default value
40000

neighborhood

Property
Type
20000
Default value
20000

streets

Property
Type
10000
Default value
10000

street

Property
Type
5000
Default value
5000

buildings

Property
Type
2500
Default value
2500

building

Property
Type
1250
Default value
1250

smallBuilding

Property
Type
800
Default value
800

rooms

Property
Type
400
Default value
400

room

Property
Type
100
Default value
100

NamedScaleRange

Type definition

The NamedScaleRange provides the minimum and maximum scale of an named scale id.

Supertypes
ScaleRange

id

Property
Type
keyof RecommendedScales

The named scale range, such as "room" or "metropolitan area".