SubtypeSublayer

AMD: require(["esri/layers/support/SubtypeSublayer"], (SubtypeSublayer) => { /* code goes here */ });
ESM: import SubtypeSublayer from "@arcgis/core/layers/support/SubtypeSublayer";
Class: esri/layers/support/SubtypeSublayer
Since: ArcGIS API for JavaScript 4.20

Represents a sublayer in a SubtypeGroupLayer. Each SubtypeSublayer is not a standalone service, but rather each sublayer corresponds to one subtype in the source feature service. This pattern allows each sublayer to be symbolized independently of one another, without requiring an individual service per sublayer. This relationship differs from the relationship between the MapImageLayer and its sublayers. In the case with the MapImageLayer, its sublayers represent individual map services.

The SubtypeSublayers are identified by their unique subtypeCode. You can configure the properties of each sublayer while initializing the SubtypeGroupLayer

See also:
Example:
// Only includes one SubtypeSublayer from the SubtypeGroupLayer
let layer = new SuptypeGroupLayer({
  url: "https://sampleserver7.arcgisonline.com/server/rest/services/UtilityNetwork/NapervilleElectric/FeatureServer/0",
  sublayers: [{  // autocasts as a Collection of SubtypeSublayers
    subtypeCode: 14,
    visible: true,
    renderer: {
      type: "simple",  // autocasts as a SimpleRenderer()
      symbol: {
        type: "simple-marker",  // autocasts as a SimpleMarkerSymbol()
        style: "circle",
        color: [120, 120, 120, 255],
        size: 6
      }
    }
  }]
});

Constructors

new SubtypeSublayer(properties)
Parameter:
properties Object
optional

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

Property Overview

Name Type Summary Class
Objectmore details

A list of custom parameters appended to the URL of all resources fetched by the layer.

more detailsSubtypeSublayer
LabelClass[]more details

The label definition for this layer, specified as an array of LabelClass.

more detailsSubtypeSublayer
Booleanmore details

Indicates whether to display labels for this layer.

more detailsSubtypeSublayer
Booleanmore details

Indicates whether the layer will be included in the legend.

more detailsSubtypeSublayer
Numbermore details

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

more detailsSubtypeSublayer
Numbermore details

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

more detailsSubtypeSublayer
Booleanmore details

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

more detailsSubtypeSublayer
PopupTemplatemore details

The popup template for the layer.

more detailsSubtypeSublayer
Renderermore details

The renderer assigned to the layer.

more detailsSubtypeSublayer
Numbermore details

The unique identifier representing the SubtypeSublayer created from the SubtypeGroupLayer.

more detailsSubtypeSublayer
FeatureTemplate[]more details

An array of feature templates defined in the feature layer.

more detailsSubtypeSublayer
Stringmore details

The title of the layer used to identify it in places such as the Legend widget.

more detailsSubtypeSublayer
Stringmore details For SubtypeSublayer the type is always "subtype-sublayer". more detailsSubtypeSublayer

Property Details

customParameters Object

A list of custom parameters appended to the URL of all resources fetched by the layer. It's an object with key-value pairs where value is a string.

Example:
// send a custom parameter to your special service
let layer = new MapImageLayer({
  url: serviceUrl,
  customParameters: {
    "key": "my-special-key"
  }
});
labelingInfo LabelClass[]autocast
Autocasts from Object[]

The label definition for this layer, specified as an array of LabelClass. Use this property to specify labeling properties for the layer such as label expression, placement, and size.

Multiple Label classes with different where clauses can be used to define several labels with varying styles on the same feature. Likewise, multiple label classes may be used to label different types of features (for example blue labels for lakes and green labels for parks).

See the Labeling guide page for more information and known limitations.

Known Limitations

3D SceneViews only support one LabelClass per feature.

See also:
Example:
const statesLabelClass = new LabelClass({
  labelExpressionInfo: { expression: "$feature.NAME" },
  symbol: {
    type: "text",  // autocasts as new TextSymbol()
    color: "black",
    haloSize: 1,
    haloColor: "white"
  }
});

subtypeSubLayer.labelingInfo = [ statesLabelClass ];
labelsVisible Boolean

Indicates whether to display labels for this layer. If true, labels will appear as defined in the labelingInfo property.

Known Limitations

3D SceneViews only support one LabelClass per feature.

Default Value:true
legendEnabled Boolean

Indicates whether the layer will be included in the legend.

Default Value:true
maxScale Number

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 0 means the layer does not have a maximum scale. The maxScale value should always be smaller than the minScale value, and greater than or equal to the service specification.

Default Value:0
minScale Number

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 0 means the layer does not have a minimum scale. The minScale value should always be larger than the maxScale value, and lesser than or equal to the service specification.

Default Value:0
popupEnabled Boolean

Indicates whether to display popups when features in the layer are clicked. The layer needs to have a popupTemplate to define what information should be displayed in the popup. Alternatively, a default popup template may be automatically used if Popup.defaultPopupTemplateEnabled is set to true.

Default Value:true
See also:
popupTemplate PopupTemplateautocast

The popup template for the layer. When set on the layer, the popupTemplate allows users to access attributes and display their values in the view's popup when a feature is selected using text and/or charts. See the PopupTemplate sample for an example of how PopupTemplate interacts with a FeatureLayer.

A default popup template is automatically used if no popupTemplate has been defined when Popup.defaultPopupTemplateEnabled is set to true.

See also:
renderer Rendererautocast

The renderer assigned to the layer. The renderer defines how to visualize each feature in the layer. Depending on the renderer type, features may be visualized with the same symbol, or with varying symbols based on the values of provided attribute fields or functions.

However, when creating a FeatureLayer from client-side features, this property must be specified in the layer's constructor along with the source, fields, objectIdField properties.

See also:
Example:
// all features in the layer will be visualized with
// a 6pt black marker symbol and a thin, white outline
layer.renderer = {
  type: "simple",  // autocasts as new SimpleRenderer()
  symbol: {
    type: "simple-marker",  // autocasts as new SimpleMarkerSymbol()
    size: 6,
    color: "black",
    outline: {  // autocasts as new SimpleLineSymbol()
      width: 0.5,
      color: "white"
    }
  }
};
subtypeCode Number

The unique identifier representing the SubtypeSublayer created from the SubtypeGroupLayer.

Default Value:null
templates FeatureTemplate[]

An array of feature templates defined in the feature layer. See ArcGIS Pro subtypes document.

title String

The title of the layer used to identify it in places such as the Legend widget. The title is set to the subtype description of layer.

type Stringreadonly

For SubtypeSublayer the type is always "subtype-sublayer".

Method Overview

Name Return Type Summary Class
PopupTemplatemore details

Creates a popup template for the layer, populated with all the fields of the layer.

more detailsSubtypeSublayer

Method Details

createPopupTemplate(options){PopupTemplate}

Creates a popup template for the layer, populated with all the fields of the layer.

Parameter:
optional

Options for creating the popup template.

Returns:
Type Description
PopupTemplate The popup template, or null if the layer does not have any fields.

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