Skip to content
Types
import type { SublayersOwner } from "@arcgis/core/layers/mixins/SublayersOwner.js";
Subclasses:
MapImageLayer, TileLayer

Mixin for MapImageLayer and TileLayer.

Properties

PropertyTypeClass

subtables

autocast Property
Type
Collection<Sublayer> | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.30

A flat Collection of all the tables in the layer including the tables of its sublayers. Apps can add them to a map as standalone tables.

Example
// Apps can add tables to a map as standalone tables
layer.subtables.forEach((subtable) => {
const featureLayer = await subtable.createFeatureLayer();
map.tables.add(featureLayer);
});

Methods

MethodSignatureClass
createServiceSublayers(): Collection<Sublayer>
findSublayerById(id: number): Sublayer | null | undefined

createServiceSublayers

Method
Signature
createServiceSublayers (): Collection<Sublayer>

Returns a deep clone of a map service's sublayers as defined by the service. This is useful for scenarios when the developer is unfamiliar with the service sublayers and needs to "reset" the layer's sublayers to match those defined by the service.

Returns
Collection<Sublayer>

A collection of sublayers as defined by the map service.

Example
Layer.fromPortalItem({
portalItem: {
portalId: "dbb9b48477444015912061b182f196b9"
}
}).then(function(layer){
let serviceSublayers = layer.createServiceSublayers();
layer.sublayers = serviceSublayers;
});

findSublayerById

Method
Signature
findSublayerById (id: number): Sublayer | null | undefined

Returns the sublayer with the given layerId.

Parameters
ParameterTypeDescriptionRequired
id

The Sublayer.id of the sublayer.

Returns
Sublayer | null | undefined

Returns the sublayer at the given layer ID.

Example
// returns the sublayer with a layerId of 0
let sublayer0 = layer.findSublayerById(0);