Skip to content
import WMSSublayer from "@arcgis/core/layers/support/WMSSublayer.js";
Inheritance:
WMSSublayerAccessor
Since
ArcGIS Maps SDK for JavaScript 4.4

Represents a sublayer in a WMSLayer.

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.

declaredClass

readonlyinherited Property
Type
string
Inherited from: Accessor
Since
ArcGIS Maps SDK for JavaScript 4.7

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

description

Property
Type
string

Description for the WMS sublayer. This defaults to the value of the Abstract property from the WMS GetCapabilities request.

dimensions

readonly Property
Type
WMSDimension[] | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.20

An array of time, elevation and other dimensions for the sublayer. Information from a TimeDimension can be used to update View.timeExtent, WMSLayer.timeExtent, or to configure a TimeSlider widget.

A WMSLayer or WMSSublayer can only have one time dimension. The following example shows how to find the time dimension (if any) for the base layer.

const layer = new WMSLayer({
url: "https://public-wms.met.no/verportal/verportal.map?request=GetCapabilities&service=WMS&version=1.3.0"
});
await layer.load();
const precipitation = layer.allSublayers.find((sl) => sl.name === "precipitation_3h_global");
layer.sublayers = [precipitation];
const timeDimension = precipitation.dimensions.find((dimension) => dimension.name === "time");

Data can exist at specific times or time ranges. We can access this information from the extent property of the TimeDimension as either an array of discrete dates or DimensionIntervals. For example, continuing from the previous example, a TimeSlider is configured using the extent from a TimeDimension.

const dates = timeDimension.extent; // This time dimension is expressed as an array of dates.
const start = dates[0]; // Get the first and earliest date
const end = dates[dates.length -1]; // Get last date
const timeSlider = new TimeSlider({
container: "timeSliderDiv",
view: view,
mode: "instant",
timeVisible: true,
loop: true,
fullTimeExtent: { // The TimeSlider UI will span all dates
start,
end
},
stops: {
dates // The TimeSlider thumb will snap exactly to each valid date
}
})

fullExtent

autocast Property
Type
Extent

The full extent of the layer.

id

Property
Type
number

The id for the WMS sublayer.

layer

Property
Type
WMSLayer | null | undefined

The WMSLayer to which the sublayer belongs.

legendEnabled

Property
Type
boolean

Indicates whether the layer will be included in the legend. When false, the layer will be excluded from the legend.

Default value
true

legendUrl

Property
Type
string | null | undefined

A string url pointing to a legend image for the layer.

maxScale

Property
Type
number
Since
ArcGIS Maps SDK for JavaScript 4.14

The maximum scale (most zoomed in) at which the layer is visible in the view. If the map is zoomed in beyond this scale, the layer will not be visible. A value of zero means the layer does not have a maximum scale.

Default value
0

minScale

Property
Type
number
Since
ArcGIS Maps SDK for JavaScript 4.14

The minimum scale (most zoomed out) at which the layer is visible in the view. If the map is zoomed out beyond this scale, the layer will not be visible. A value of zero means the layer does not have a minimum scale.

Default value
0

name

Property
Type
string

Name of the WMS sublayer. This defaults to the value of the Name property from the WMS GetCapabilities request.

parent

Property
Type
WMSSublayer | WMSLayer | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.17

Returns a reference to the parent WMS sublayer or layer.

Example
// Display the title and description for the WMS sublayer named "RADAR_1KM_RDBR".
const wmsLayer = new WMSLayer({
url: "https://geo.weather.gc.ca/geomet"
});
wmsLayer.load().then(() => {
const subLayer = layer.findSublayerByName("RADAR_1KM_RDBR");
let parent = wmsSubLayer.parent;
while(parent) {
parent.visible = true;
parent = parent.parent;
}
});

popupEnabled

Property
Type
boolean

Indicates whether to display popups when features in the layer are clicked.

Default value
false

queryable

Property
Type
boolean

Indicates if the layer can be queried, i.e. the service supports GetFeatureInfo with either text/html or text/plain formats.

Default value
false

spatialReferences

Property
Type
number[] | null | undefined

List of spatialReferences (WKID) derived from the CRS elements of the first layer in the GetCapabilities request.

sublayers

autocast Property
Type
Collection<WMSSublayer> | null | undefined

A collection of WMSSublayers.

title

Property
Type
string | null | undefined

The title of the WMS sublayer used to identify it in places such as the LayerList and Legend. This defaults to the value of the Title property from the WMS GetCapabilities request.

uid

readonlyinherited Property
Type
string
Inherited from: IdentifiableMixin
Since
ArcGIS Maps SDK for JavaScript 4.33

An automatically generated unique identifier assigned to the instance. The unique id is generated each time the application is loaded.

visible

Property
Type
boolean

Indicates if the layer is visible in the view.

Methods

MethodSignatureClass
clone(): WMSSublayer

clone

Method
Signature
clone (): WMSSublayer

Creates a deep clone of the WMS sublayer.

Returns
WMSSublayer

A deep clone of the WMS sublayer instance that invoked this method.