WMSSublayer

AMD: require(["esri/layers/support/WMSSublayer"], (WMSSublayer) => { /* code goes here */ });
ESM: import WMSSublayer from "@arcgis/core/layers/support/WMSSublayer.js";
Class: esri/layers/support/WMSSublayer
Inheritance: WMSSublayerAccessor
Since: ArcGIS Maps SDK for JavaScript 4.4

Represents a sublayer in a WMSLayer.

Constructors

WMSSublayer

Constructor
new WMSSublayer(properties)
Parameter
properties Object
optional

See the properties for a list of all the properties that may be passed into the constructor.

Property Overview

Any properties can be set, retrieved or listened to. See the Watch for changes topic.
Show inherited properties Hide inherited properties
Name Type Summary Class

The name of the class.

Accessor

Description for the WMS sublayer.

WMSSublayer

An array of time, elevation and other dimensions for the sublayer.

WMSSublayer

The full extent of the layer.

WMSSublayer

The id for the WMS sublayer.

WMSSublayer

The WMSLayer to which the sublayer belongs.

WMSSublayer

Indicates whether the layer will be included in the legend.

WMSSublayer

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

WMSSublayer

The maximum scale (most zoomed in) at which the layer is visible in the view.

WMSSublayer

The minimum scale (most zoomed out) at which the layer is visible in the view.

WMSSublayer

Name of the WMS sublayer.

WMSSublayer

Returns a reference to the parent WMS sublayer or layer.

WMSSublayer

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

WMSSublayer

Indicates if the layer can be queried, i.e.

WMSSublayer

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

WMSSublayer

A collection of WMSSublayers.

WMSSublayer

The title of the WMS sublayer used to identify it in places such as the LayerList and Legend widgets.

WMSSublayer

Indicates if the layer is visible in the view.

WMSSublayer

Property Details

declaredClass

Inherited
Property
declaredClass Stringreadonly
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.7 Accessor since 4.0, declaredClass added at 4.7.

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

description

Property
description String

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

dimensions

Property
dimensions Array<(TimeDimension|ElevationDimension|GenericDimension)>readonly
Since: ArcGIS Maps SDK for JavaScript 4.20 WMSSublayer since 4.4, dimensions added at 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 TimeDimensionIntervals. 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

Property
fullExtent Extent

The full extent of the layer.

id

Property
id Number

The id for the WMS sublayer.

layer

Property
layer WMSLayer

The WMSLayer to which the sublayer belongs.

legendEnabled

Property
legendEnabled 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
legendUrl String

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

maxScale

Property
maxScale Number
Since: ArcGIS Maps SDK for JavaScript 4.14 WMSSublayer since 4.4, maxScale added at 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
minScale Number
Since: ArcGIS Maps SDK for JavaScript 4.14 WMSSublayer since 4.4, minScale added at 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
name String

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

parent

Property
parent WMSSublayer |WMSLayer
Since: ArcGIS Maps SDK for JavaScript 4.17 WMSSublayer since 4.4, parent added at 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
popupEnabled Boolean

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

Default Value:false

queryable

Property
queryable 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
spatialReferences Number[]

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

sublayers

Property
sublayers Collection<WMSSublayer>

A collection of WMSSublayers.

title

Property
title String

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

visible

Property
visible Boolean

Indicates if the layer is visible in the view.

Method Overview

Show inherited methods Hide inherited methods
Name Return Type Summary Class

Adds one or more handles which are to be tied to the lifecycle of the object.

Accessor

Creates a deep clone of the WMS sublayer.

WMSSublayer

Returns true if a named group of handles exist.

Accessor

Removes a group of handles owned by the object.

Accessor

Method Details

addHandles

Inherited
Method
addHandles(handleOrHandles, groupKey)
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, addHandles added at 4.25.

Adds one or more handles which are to be tied to the lifecycle of the object. The handles will be removed when the object is destroyed.

// Manually manage handles
const handle = reactiveUtils.when(
  () => !view.updating,
  () => {
    wkidSelect.disabled = false;
  },
  { once: true }
);

this.addHandles(handle);

// Destroy the object
this.destroy();
Parameters
handleOrHandles WatchHandle|WatchHandle[]

Handles marked for removal once the object is destroyed.

groupKey *
optional

Key identifying the group to which the handles should be added. All the handles in the group can later be removed with Accessor.removeHandles(). If no key is provided the handles are added to a default group.

clone

Method
clone(){WMSSublayer}

Creates a deep clone of the WMS sublayer.

Returns
Type Description
WMSSublayer A deep clone of the WMS sublayer instance that invoked this method.

hasHandles

Inherited
Method
hasHandles(groupKey){Boolean}
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, hasHandles added at 4.25.

Returns true if a named group of handles exist.

Parameter
groupKey *
optional

A group key.

Returns
Type Description
Boolean Returns true if a named group of handles exist.
Example
// Remove a named group of handles if they exist.
if (obj.hasHandles("watch-view-updates")) {
  obj.removeHandles("watch-view-updates");
}

removeHandles

Inherited
Method
removeHandles(groupKey)
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, removeHandles added at 4.25.

Removes a group of handles owned by the object.

Parameter
groupKey *
optional

A group key or an array or collection of group keys to remove.

Example
obj.removeHandles(); // removes handles from default group

obj.removeHandles("handle-group");
obj.removeHandles("other-handle-group");

Type Definitions

ElevationDimension

Type Definition
ElevationDimension Object

Elevation dimension information.

Property
name String

Name of dimensional axis.

The value is always "elevation".

GenericDimension

Type Definition
GenericDimension Object

Generic dimension information.

Property
name String

Name of dimensional axis.

TimeDimension

Type Definition
TimeDimension Object

Time dimension information. For example, the WMS service might be published to show hourly weather information. The TimeDimension can be used to update View.timeExtent, WMSLayer.timeExtent, or to configure a TimeSlider widget.

Properties
name String

Name of dimensional axis.

The value is always "time".

units String

Units of dimensional axis.

The value is always "ISO8601".

Available value(s) for the time dimension.

Default value(s) for the time dimension. The default value will be used if the request does not include a value for the time dimension.

multipleValues Boolean

Indicates whether multiple values of the dimension may be requested.

nearestValue Boolean

Indicates whether the nearest value of the dimension will be returned in response to a request for a nearby value.

TimeDimensionInterval

Type Definition
TimeDimensionInterval Object

The time dimension interval.

Properties
min Date

Start of interval.

max Date

End of interval.

resolution Object

Interval duration defined by the following properties.

Specification
years Number

Number of years.

months Number

Number of months.

days Number

Number of days.

hours Number

Number of hours.

minutes Number

Number of minutes.

seconds Number

Number of seconds.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.