import WMSSublayer from "@arcgis/core/layers/support/WMSSublayer.js";const WMSSublayer = await $arcgis.import("@arcgis/core/layers/support/WMSSublayer.js");- Inheritance:
- WMSSublayer→
Accessor
- Since
- ArcGIS Maps SDK for JavaScript 4.4
Represents a sublayer in a WMSLayer.
Constructors
Constructor
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| properties | | |
Properties
| Property | Type | Class |
|---|---|---|
declaredClass readonly inherited | ||
| | ||
dimensions readonly | WMSDimension[] | null | undefined | |
| | ||
| | ||
| | ||
| | ||
| | ||
| | ||
| | ||
| | ||
WMSSublayer | WMSLayer | null | undefined | | |
| | ||
| | ||
| | ||
| | ||
| | ||
uid readonly inherited | ||
| |
description
- Type
- string
Description for the WMS sublayer. This defaults to the value of the Abstract property from the WMS GetCapabilities request.
dimensions
- 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 dateconst end = dates[dates.length -1]; // Get last dateconst 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 }}) legendEnabled
- 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
maxScale
- 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
- 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
- Type
- string
Name of the WMS sublayer. This defaults to the value of the Name property from the WMS GetCapabilities request.
parent
- 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
- Type
- boolean
Indicates whether to display popups when features in the layer are clicked.
- Default value
- false
queryable
- 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
sublayers
- Type
- Collection<WMSSublayer> | null | undefined
A collection of WMSSublayers.
uid
- Type
- string
- 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.
Methods
| Method | Signature | Class |
|---|---|---|
clone(): WMSSublayer | |
clone
- 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.