require(["esri/layers/support/WMSSublayer"], (WMSSublayer) => { /* code goes here */ });
import WMSSublayer from "@arcgis/core/layers/support/WMSSublayer.js";
esri/layers/support/WMSSublayer
Represents a sublayer in a WMSLayer.
Constructors
-
Parameterproperties Objectoptional
See the properties for a list of all the properties that may be passed into the constructor.
Property Overview
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
-
description
description String
-
Description for the WMS sublayer. This defaults to the value of the Abstract property from the WMS GetCapabilities request.
-
dimensions
dimensions Array<(TimeDimension|ElevationDimension|GenericDimension)>readonly
Since: ArcGIS Maps SDK for JavaScript 4.20WMSSublayer 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
fullExtent Extent
-
The full extent of the layer.
-
id
id Number
-
The id for the WMS sublayer.
-
legendEnabled
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
legendUrl String
-
A string url pointing to a legend image for the layer.
-
maxScale
maxScale Number
Since: ArcGIS Maps SDK for JavaScript 4.14WMSSublayer 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
minScale Number
Since: ArcGIS Maps SDK for JavaScript 4.14WMSSublayer 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
name String
-
Name of the WMS sublayer. This defaults to the value of the Name property from the WMS GetCapabilities request.
-
parent
parent WMSSublayer |WMSLayer
Since: ArcGIS Maps SDK for JavaScript 4.17WMSSublayer 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
popupEnabled Boolean
-
Indicates whether to display popups when features in the layer are clicked.
- Default Value:false
-
queryable
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
-
List of spatialReferences (WKID) derived from the CRS elements of the first layer in the GetCapabilities request.
-
sublayers
sublayers Collection<WMSSublayer>
-
A collection of WMSSublayers.
-
visible
visible Boolean
-
Indicates if the layer is visible in the view.
Method Overview
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
-
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25Accessor 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();
ParametershandleOrHandles WatchHandle|WatchHandle[]Handles marked for removal once the object is destroyed.
groupKey *optionalKey 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
clone(){WMSSublayer}
-
Creates a deep clone of the WMS sublayer.
ReturnsType Description WMSSublayer A deep clone of the WMS sublayer instance that invoked this method.
-
hasHandles
InheritedMethodhasHandles(groupKey){Boolean}
Inherited from AccessorSince: ArcGIS Maps SDK for JavaScript 4.25Accessor since 4.0, hasHandles added at 4.25. -
Returns true if a named group of handles exist.
ParametergroupKey *optionalA group key.
ReturnsType 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"); }
-
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25Accessor since 4.0, removeHandles added at 4.25. -
Removes a group of handles owned by the object.
ParametergroupKey *optionalA group key or an array or collection of group keys to remove.
Exampleobj.removeHandles(); // removes handles from default group obj.removeHandles("handle-group"); obj.removeHandles("other-handle-group");
Type Definitions
-
TimeDimension
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 StringUnits of dimensional axis.
The value is always "ISO8601".
extent Date[]|TimeDimensionInterval[]Available value(s) for the time dimension.
default Date[]|TimeDimensionInterval[]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 BooleanIndicates whether multiple values of the dimension may be requested.
nearestValue BooleanIndicates whether the nearest value of the dimension will be returned in response to a request for a nearby value.