WMSSublayer

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

Represents a sublayer in a WMSLayer.

Constructors

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 Working with Properties topic.
Show inherited properties Hide inherited properties
Name Type Summary Class
String

The name of the class.

more details
Accessor
String

Description for the WMS sublayer.

more details
WMSSublayer
Array<(TimeDimension|ElevationDimension|GenericDimension)>

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

more details
WMSSublayer
Extent

The full extent of the layer.

more details
WMSSublayer
Number

The id for the WMS sublayer.

more details
WMSSublayer
WMSLayer

The WMSLayer to which the sublayer belongs.

more details
WMSSublayer
Boolean

Indicates whether the layer will be included in the legend.

more details
WMSSublayer
String

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

more details
WMSSublayer
Number

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

more details
WMSSublayer
Number

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

more details
WMSSublayer
String

Name of the WMS sublayer.

more details
WMSSublayer
WMSSublayer|WMSLayer

Returns a reference to the parent WMS sublayer or layer.

more details
WMSSublayer
Boolean

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

more details
WMSSublayer
Boolean

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

more details
WMSSublayer
Number[]

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

more details
WMSSublayer
Collection<WMSSublayer>

A collection of WMSSublayers.

more details
WMSSublayer
String

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

more details
WMSSublayer
Boolean

Indicates if the layer is visible in the view.

more details
WMSSublayer

Property Details

declaredClass Stringreadonly inherited
Since: ArcGIS Maps SDK for JavaScript 4.7

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

description String

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

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 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 Extent

The full extent of the layer.

id Number

The id for the WMS sublayer.

layer WMSLayer

The WMSLayer to which the sublayer belongs.

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 String

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

maxScale 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 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 String

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

parent WMSSublayer|WMSLayer
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 Boolean

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

Default Value:false
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 Number[]

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

sublayers Collection<WMSSublayer>

A collection of WMSSublayers.

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 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.

more details
Accessor
WMSSublayer

Creates a deep clone of the WMS sublayer.

more details
WMSSublayer
Boolean

Returns true if a named group of handles exist.

more details
Accessor

Removes a group of handles owned by the object.

more details
Accessor

Method Details

addHandles(handleOrHandles, groupKey)inherited
Since: ArcGIS Maps SDK for JavaScript 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 }
);

// Handle gets removed when the object is destroyed.
this.addHandles(handle);
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(){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(groupKey){Boolean}inherited
Since: ArcGIS Maps SDK for JavaScript 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(groupKey)inherited
Since: ArcGIS Maps SDK for JavaScript 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 Object

Elevation dimension information.

Property
name String

Name of dimensional axis.

The value is always "elevation".

GenericDimension Object

Generic dimension information.

Property
name String

Name of dimensional axis.

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 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.