UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

941 lines (939 loc) • 62 kB
import type Graphic from "../../Graphic.js"; import type PopupTemplate from "../../PopupTemplate.js"; import type Collection from "../../core/Collection.js"; import type Extent from "../../geometry/Extent.js"; import type SpatialReference from "../../geometry/SpatialReference.js"; import type FeatureLayer from "../FeatureLayer.js"; import type MapImageLayer from "../MapImageLayer.js"; import type TileLayer from "../TileLayer.js"; import type EditFieldsInfo from "./EditFieldsInfo.js"; import type FeatureType from "./FeatureType.js"; import type Field from "./Field.js"; import type FieldsIndex from "./FieldsIndex.js"; import type LabelClass from "./LabelClass.js"; import type LayerFloorInfo from "./LayerFloorInfo.js"; import type OrderByInfo from "./OrderByInfo.js"; import type Relationship from "./Relationship.js"; import type DynamicDataLayer from "../../rest/layerSources/DynamicDataLayer.js"; import type DynamicMapLayer from "../../rest/layerSources/DynamicMapLayer.js"; import type AttachmentInfo from "../../rest/query/support/AttachmentInfo.js"; import type FeatureSet from "../../rest/support/FeatureSet.js"; import type Query from "../../rest/support/Query.js"; import type AttributeTableTemplate from "../../tables/AttributeTableTemplate.js"; import type { ReadonlyArrayOrCollection } from "../../core/Collection.js"; import type { IdentifiableMixin, IdentifiableMixinProperties } from "../../core/Identifiable.js"; import type { Loadable, LoadableMixinProperties } from "../../core/Loadable.js"; import type { MultiOriginJSONSupportMixin } from "../../core/MultiOriginJSONSupport.js"; import type { AbortOptions } from "../../core/promiseUtils.js"; import type { FieldDomainOptions } from "../types.js"; import type { DomainUnion, SublayerCapabilities } from "./types.js"; import type { RendererUnion } from "../../renderers/types.js"; import type { AttachmentQueryProperties } from "../../rest/support/AttachmentQuery.js"; import type { QueryProperties } from "../../rest/support/Query.js"; import type { RelationshipQueryProperties } from "../../rest/support/RelationshipQuery.js"; import type { CreatePopupTemplateOptions } from "../../support/popupUtils.js"; import type { ObjectId } from "../../views/types.js"; import type { AttributeTableTemplateProperties } from "../../tables/AttributeTableTemplate.js"; import type { LayerFloorInfoProperties } from "./LayerFloorInfo.js"; import type { LabelClassProperties } from "./LabelClass.js"; import type { OrderByInfoProperties } from "./OrderByInfo.js"; import type { PopupTemplateProperties } from "../../PopupTemplate.js"; import type { HeatmapRendererProperties } from "../../renderers/HeatmapRenderer.js"; import type { PieChartRendererProperties } from "../../renderers/PieChartRenderer.js"; import type { DictionaryRendererProperties } from "../../renderers/DictionaryRenderer.js"; import type { DotDensityRendererProperties } from "../../renderers/DotDensityRenderer.js"; import type { UniqueValueRendererProperties } from "../../renderers/UniqueValueRenderer.js"; import type { ClassBreaksRendererProperties } from "../../renderers/ClassBreaksRenderer.js"; import type { SimpleRendererProperties } from "../../renderers/SimpleRenderer.js"; import type { DynamicDataLayerProperties } from "../../rest/layerSources/DynamicDataLayer.js"; import type { DynamicMapLayerProperties } from "../../rest/layerSources/DynamicMapLayer.js"; export interface SublayerProperties extends LoadableMixinProperties, IdentifiableMixinProperties, Partial<Pick<Sublayer, "definitionExpression" | "id" | "labelsVisible" | "layer" | "legendEnabled" | "listMode" | "maxScale" | "minScale" | "opacity" | "parent" | "popupEnabled" | "sourceJSON" | "title" | "url" | "visible">> { /** * This property is used to configure the associated layer's [FeatureTable](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/). It is meant to configure how the columns display within the table in regard to visibility, column order, and sorting. * * > [!WARNING] * > * > This property differs from a [FeatureTable's tableTemplate](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/support/TableTemplate/) property. The `TableTemplate` provides more fine-grained control over how the table is rendered within the application by offering more advanced configurations such as custom cell rendering, column formatting, and more. `TableTemplate` is useful for application-level development that remains within an application. Use the `attributeTableTemplate` property to access the table's settings across different applications. By using this property, the settings can be saved within a webmap or layer. Please refer to the [AttributeTableTemplate](https://developers.arcgis.com/javascript/latest/references/core/tables/AttributeTableTemplate/) and [TableTemplate](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/support/TableTemplate/) documentation for more information. * * @since 4.33 */ attributeTableTemplate?: AttributeTableTemplateProperties | null; /** * If a map image layer contains a sublayer which is meant to be floor-aware, then that sublayer * must have a floorInfo property, containing a [LayerFloorInfo](https://developers.arcgis.com/javascript/latest/references/core/layers/support/LayerFloorInfo/) object * which has a string property to represent the floorField. * * @since 4.21 */ floorInfo?: LayerFloorInfoProperties | null; /** * The label definition for this layer, * specified as an array of [LabelClass](https://developers.arcgis.com/javascript/latest/references/core/layers/support/LabelClass/) objects. * Use this property to specify labeling properties for the layer such as label expression, placement, and size. * * @see [Sample - MapImageLayer: label sublayer features](https://developers.arcgis.com/javascript/latest/sample-code/layers-mapimagelayer-dynamic-labels/) * @example * let layer = new MapImageLayer({ * url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer", * sublayers: [{ * id: 3, * labelsVisible: true, * // labelingInfo autocasts to an array of LabelClass objects * labelingInfo: [{ * labelExpression: "[name]", * labelPlacement: "always-horizontal", * symbol: { * type: "text", // autocasts as new TextSymbol() * color: [255, 255, 255, 0.7], * haloColor: [0, 0, 0, 0.85], * haloSize: 1, * font: { * size: 11 * } * }, * minScale: 2400000, * maxScale: 73000 * }] * }] * }); */ labelingInfo?: LabelClassProperties[] | null; /** * Determines the order in which features are drawn in the view. You * can sort features by a field value or the value returned from an * [Arcade](https://developers.arcgis.com/javascript/latest/arcade/) expression in ascending or descending order. * * When `null` (default), features are drawn in the order they are returned from * the service or client. * * > [!WARNING] * > * > **Known Limitations** * > * > - Feature drawing order configurations defined with Arcade expressions cannot be [saved](https://developers.arcgis.com/javascript/latest/references/core/WebMap/#save) to web maps. * > - Currently, you can only sort features by one field or expression. * > - This property cannot be [saved](https://developers.arcgis.com/javascript/latest/references/core/WebScene/#save) to a web scene. * * @since 4.32 * @see [Arcade Feature Z Profile](https://developers.arcgis.com/javascript/latest/arcade/#feature-sorting) * @example * // Features with larger population values will * // be rendered on top of smaller features. * sublayer.orderBy = [ * { * field: "POP2024", * order: "descending" * } * ]; */ orderBy?: OrderByInfoProperties[] | null; /** * The popup template for the sublayer. When set, the `popupTemplate` * allows users to access attributes and display their values in the * view's Popup when the user clicks * the image. * * Sublayers with a [RasterDataSource](https://developers.arcgis.com/javascript/latest/references/core/rest/layerSources/RasterDataSource/) cannot be queried and * therefore do not support [PopupTemplate](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/). * * Alternatively, a default popup template may be automatically used if * [Popup.defaultPopupTemplateEnabled](https://developers.arcgis.com/javascript/latest/references/core/widgets/Popup/#defaultPopupTemplateEnabled) is set to `true`. * * > [!WARNING] * > * > **Known Limitations** * > * > [Arcade](https://developers.arcgis.com/javascript/latest/arcade/) expressions * > are not supported in PopupTemplates set on MapImageLayer sublayers or TileLayer sublayers * > unless they reference ArcGIS Enterprise 10.6 map services (or later) created from ArcGIS Pro. * * @see [Sample - MapImageLayer: dynamic data layer with table join](https://developers.arcgis.com/javascript/latest/sample-code/layers-dynamicdatalayer-table-join/) * @example * let layer = new MapImageLayer({ * url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer", * sublayers: [{ * id: 0, * popupTemplate: { * title: "{COUNTY}", * content: "{POP2007} people lived in this county in 2007" * } * }] * }); */ popupTemplate?: PopupTemplateProperties | null; /** * The renderer to apply to the sublayer. * This value overrides the renderer read from the map service. * To see if you can use this property, check the * `supportsDynamicLayers` property of * [MapImageLayer.capabilities](https://developers.arcgis.com/javascript/latest/references/core/layers/MapImageLayer/#capabilities). * * > [!WARNING] * > * > **Known Limitations** * > * > [3D symbols](https://developers.arcgis.com/javascript/latest/references/core/symbols/Symbol3D/) are not currently supported in * > renderers set on sublayers. * > [Visual variables](https://developers.arcgis.com/javascript/latest/references/core/renderers/SimpleRenderer/#visualVariables) and * > [Arcade](https://developers.arcgis.com/javascript/latest/arcade/) expressions * > are not supported in renderers set on MapImageLayer sublayers * > unless they reference ArcGIS Enterprise 10.6 map services (or later) created from ArcGIS Pro. * * @see [Sample - MapImageLayer: set renderers on sublayers](https://developers.arcgis.com/javascript/latest/sample-code/layers-mapimagelayer-renderers/) * @example * let layer = new MapImageLayer({ * url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer", * sublayers: [{ * id: 0, * renderer: { * type: "simple", // autocasts as new SimpleRenderer() * symbol: { * type: "simple-marker", // autocasts as new SimpleMarkerSymbol() * color: "black", * size: 8 * } * } * }] * }); */ renderer?: (((SimpleRendererProperties & { type: "simple" }) | (ClassBreaksRendererProperties & { type: "class-breaks" }) | (UniqueValueRendererProperties & { type: "unique-value" }) | (DotDensityRendererProperties & { type: "dot-density" }) | (DictionaryRendererProperties & { type: "dictionary" }) | (PieChartRendererProperties & { type: "pie-chart" })) | (HeatmapRendererProperties & { type: "heatmap" })) | null; /** * An object that allows you to create a dynamic layer with data * either from the map service sublayers or data from a registered workspace. * See [DynamicMapLayer](https://developers.arcgis.com/javascript/latest/references/core/rest/layerSources/DynamicMapLayer/) * for creating dynamic layers from map service layers for on the fly * rendering, labeling, and filtering (definition expressions). To create * dynamic layers from other sources in registered workspaces such as tables and table joins, * see [DynamicDataLayer](https://developers.arcgis.com/javascript/latest/references/core/rest/layerSources/DynamicDataLayer/). * * @example * // Creates two sublayers that point to the same map service layer. * // Each layer presents different features in the data using * // definition expressions and renderers. * let mapImageLayer = new MapImageLayer({ * sublayers: [{ * id: 10, * definitionExpression: "POP < 100000", * renderer: { * type: "simple", // autocasts as new SimpleRenderer() * symbol: smallMarker * }, * source: { * type: "map-layer", * mapLayerId: 0 * } * }, { * id: 11, * definitionExpression: "POP > 100001", * renderer: { * type: "simple", // autocasts as new SimpleRenderer() * symbol: largeMarker * }, * source: { * type: "map-layer", * mapLayerId: 0 * } * }] * }); */ source?: (DynamicMapLayerProperties & { type: "map-layer" }) | (DynamicDataLayerProperties & { type: "data-layer" }); /** * If a sublayer contains sublayers, this * property is a [Collection](https://developers.arcgis.com/javascript/latest/references/core/core/Collection/) of [Sublayer](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/) * objects belonging to the given sublayer with sublayers. * * @example * // test function for determining if a MapImageLayer's sublayers * // contain at least one dynamic data layer * function hasDynamicDataLayer (layer){ * if (layer.sublayers && layer.sublayers.sublayers){ * return layer.sublayers.sublayers.some(function(sublayer){ * return sublayer.source.type === "data-layer"; * }); * } else { * console.log("layer does not have sublayers or nested sublayers"); * return false; * } * } */ sublayers?: ReadonlyArrayOrCollection<SublayerProperties>; } /** * Represents a sublayer in a [MapImageLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/MapImageLayer/) or a [TileLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/TileLayer/). * MapImageLayer allows you to display, query, and analyze layers from data defined in a [map service](https://enterprise.arcgis.com/en/server/latest/publish-services/windows/what-is-a-map-service.htm). * Map services contain sublayers with properties such as [renderer](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/#renderer), * [labelingInfo](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/#labelingInfo), and [definitionExpression](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/#definitionExpression), and others that are * defined on the server. The properties of each MapImageLayer sublayer on the map service may be dynamically * changed by the user or developer. The properties of each TileLayer sublayer are read-only, and cannot be modified. * * > [!WARNING] * > * > **Known Limitations** * > * > All properties of a [TileLayer's sublayers](https://developers.arcgis.com/javascript/latest/references/core/layers/TileLayer/#sublayers) are read-only, except the following: * > - [legendEnabled](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/#legendEnabled) * > - [popupEnabled](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/#popupEnabled) * > - [popupTemplate](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/#popupTemplate) * > - [title](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/#title) * > * > The following limitations apply to sublayers from all map services published with ArcMap, or published to ArcGIS Server 10.5.1 or earlier: * > [Arcade](https://developers.arcgis.com/javascript/latest/arcade/) expressions are not supported in the [renderer](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/#renderer) * > and [popupTemplate](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/#popupTemplate). * > [Visual variables](https://developers.arcgis.com/javascript/latest/references/core/renderers/SimpleRenderer/#visualVariables) are not supported in the [renderer](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/#renderer). * * ## Dynamic layers * * Sublayers may be rendered on the fly as dynamic layers. Dynamic layers are created using * the [source](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/#source) property of the sublayer. There are two types of dynamic layers: * [dynamic map layers](https://developers.arcgis.com/javascript/latest/references/core/rest/layerSources/DynamicMapLayer/) and [dynamic data layers](https://developers.arcgis.com/javascript/latest/references/core/rest/layerSources/DynamicDataLayer/). * * [Dynamic map layers](https://developers.arcgis.com/javascript/latest/references/core/rest/layerSources/DynamicMapLayer/) allow you to override sublayers in the map service with new renderers, * definition expressions, opacity, scale visibility, etc. Multiple dynamic map layers may exist * for a single map service layer. * * [Dynamic data layers](https://developers.arcgis.com/javascript/latest/references/core/rest/layerSources/DynamicDataLayer/) provide the ability to create sublayers on the fly * from data inside registered workspaces. * The data may be tables with or without geometries, feature classes, or * rasters. These data sources are not directly visible to the services directory, but may be * published and configured with the ArcGIS Server Manager. Data from tables may be joined to other * tables or dynamic map layers. * * @since 4.1 * @see [MapImageLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/MapImageLayer/) * @see [Sample - MapImageLayer: toggle sublayer visibility](https://developers.arcgis.com/javascript/latest/sample-code/layers-mapimagelayer-sublayers/) * @see [Sample - MapImageLayer: set definition expression](https://developers.arcgis.com/javascript/latest/sample-code/layers-mapimagelayer-definitionexpression/) * @see [Sample - MapImageLayer: set renderers on sublayers](https://developers.arcgis.com/javascript/latest/sample-code/layers-mapimagelayer-renderers/) * @see [Sample - MapImageLayer: label sublayer features](https://developers.arcgis.com/javascript/latest/sample-code/layers-mapimagelayer-dynamic-labels/) * @see [Sample - MapImageLayer: create dynamic map layers](https://developers.arcgis.com/javascript/latest/sample-code/layers-dynamicmaplayer/) * @see [Sample - MapImageLayer: dynamic data layer with table join](https://developers.arcgis.com/javascript/latest/sample-code/layers-dynamicdatalayer-table-join/) * @see [Sample - MapImageLayer: dynamic data layer with query table](https://developers.arcgis.com/javascript/latest/sample-code/layers-dynamicdatalayer-query-table/) * @see [Sample - MapImageLayer: dynamic data layer with raster](https://developers.arcgis.com/javascript/latest/sample-code/layers-dynamicdatalayer-raster/) * @example * // defines the properties of various sublayers in a map service * let layer = new MapImageLayer({ * url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer", * sublayers: [ * { // sets a definition expression on sublayer 3 * id: 3, * definitionExpression: "pop2000 > 40000000" * }, * { // sublayer 2 will be rendered as defined in the map service * id: 2 * }, * { // sublayer 1 will be included in the layer, with visibility off * id: 1, * visible: false * }, * { // sublayer 0 will have new renderer and label * // expressions applied in the view on the fly * id: 0, * renderer: { * type: "class-breaks" // autocasts as new ClassBreaksRenderer() * // set renderer properties here * }, * labelingInfo: [ new LabelClass ( ... ) ] * } * ] * }); */ export default class Sublayer extends SublayerSuperclass { /** * @example * // typical usage * let layer = new MapImageLayer({ * url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer", * sublayers: [ // autocasts as a Collection of Sublayers * { // sets a definition expression on sublayer 0 * id: 0, * definitionExpression: "pop2000 > 40000000" * }, * { // creates a dynamic data layer * source: { * type: dynamic-layer, * dataSource: { * type: "table", * workspaceId: "MyDatabaseWorkspaceIDSSR2", * dataSourceName: "ss6.gdb.Railroads" * } * } * } * ] * }); */ constructor(properties?: SublayerProperties); /** * This property is used to configure the associated layer's [FeatureTable](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/). It is meant to configure how the columns display within the table in regard to visibility, column order, and sorting. * * > [!WARNING] * > * > This property differs from a [FeatureTable's tableTemplate](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/support/TableTemplate/) property. The `TableTemplate` provides more fine-grained control over how the table is rendered within the application by offering more advanced configurations such as custom cell rendering, column formatting, and more. `TableTemplate` is useful for application-level development that remains within an application. Use the `attributeTableTemplate` property to access the table's settings across different applications. By using this property, the settings can be saved within a webmap or layer. Please refer to the [AttributeTableTemplate](https://developers.arcgis.com/javascript/latest/references/core/tables/AttributeTableTemplate/) and [TableTemplate](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/support/TableTemplate/) documentation for more information. * * @since 4.33 */ get attributeTableTemplate(): AttributeTableTemplate | null | undefined; set attributeTableTemplate(value: AttributeTableTemplateProperties | null | undefined); /** * Describes the layer's supported capabilities. * * @since 4.27 * @example * // Once the layer loads, check if `supportsAttachment` * // operation is enabled on the layer * * layer.when(function(){ * if (layer.capabilities.data.supportsAttachment) { * // if attachments are enabled on the layer * setupAttachments(); * } * }); */ get capabilities(): SublayerCapabilities; /** * A SQL where clause used to filter features in the image. * Only the features that satisfy the definition expression are displayed in the * [View](https://developers.arcgis.com/javascript/latest/references/core/views/View/). Definition expressions * may be set when a sublayer is constructed prior to it loading in the view or after it has * been added to the MapImageLayer. To see if you can use this property, check the * `supportsSublayerDefinitionExpression` property of * [MapImageLayer.capabilities](https://developers.arcgis.com/javascript/latest/references/core/layers/MapImageLayer/#capabilities). * * @see [Sample - MapImageLayer: set definition expression](https://developers.arcgis.com/javascript/latest/sample-code/layers-mapimagelayer-definitionexpression/) * @example * let countiesLyr = layer.sublayers.find(function(sublayer){ * return sublayer.title === "States"; * }); * countiesLyr.definitionExpression = "STATE = 'Nebraska'" * @example * // add a definition expression to sublayer when * // it is created in MapImageLayer constructor * let layer = new MapImageLayer({ * url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer", * sublayers: [{ * id: 0, * definitionExpression: "STATE = 'Nebraska'" * }] * }); * @example * // Set a definition expression on the sublayer with ID of 0 * layer.findSublayerById(0).definitionExpression = "STATE = 'Nebraska'"; */ accessor definitionExpression: string | null | undefined; /** * The editor tracking fields, which record who adds or edits the data through the feature service * and when edits are made. * * @since 5.0 */ get editFieldsInfo(): EditFieldsInfo | null | undefined; /** * An array of fields in the Sublayer. Each field represents an attribute * that may contain a value for each feature in the Sublayer. This property * is only available after the Sublayer has been [loaded](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/#loadStatus). * * @since 4.15 * @see [load()](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/#load) * @see [loadStatus](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/#loadStatus) * @example * // print the first Sublayer's first field to the console * console.log(mapImageLayer.sublayers.items[0].fields[0]); * * // OUTPUT: * alias: "OBJECTID" * defaultValue: undefined * description: "the objectid" * domain: null * editable: false * name: "objectid" * nullable: false * type: "oid" * valueType: null */ get fields(): Field[]; /** * A convenient property that can be used to make case-insensitive lookups for a [fields](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/#fields) by name. * It can also provide a list of the [date fields](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FieldsIndex/#dateFields) * in a Sublayer. This property is only available after the Sublayer has been [loaded](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/#loadStatus). * * @since 4.15 * @see [load()](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/#load) * @see [fields](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/#fields) * @example * // lookup a field by name, name is case-insensitive * const fieldsIndex = mapImageLayer.sublayers.items[0].fieldsIndex.get("OBjecTID"); * * // if there's a field by that name, print it to the console * if (fieldsIndex) { * console.log("fieldsIndex: ", fieldsIndex); * } */ get fieldsIndex(): FieldsIndex<Field>; /** * If a map image layer contains a sublayer which is meant to be floor-aware, then that sublayer * must have a floorInfo property, containing a [LayerFloorInfo](https://developers.arcgis.com/javascript/latest/references/core/layers/support/LayerFloorInfo/) object * which has a string property to represent the floorField. * * @since 4.21 */ get floorInfo(): LayerFloorInfo | null | undefined; set floorInfo(value: LayerFloorInfoProperties | null | undefined); /** * The full extent of the Sublayer. * This property is only available after the Sublayer has been [loaded](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/#loadStatus). * * @since 4.15 * @see [load()](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/#load) * @see [loadStatus](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/#loadStatus) */ get fullExtent(): Extent | null | undefined; /** * The sublayer's layer ID. When a [source](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/#source) is not defined on the * layer, this value represents the id of the sublayer defined by the map service. * If creating a [DynamicDataLayer](https://developers.arcgis.com/javascript/latest/references/core/rest/layerSources/DynamicDataLayer/) or a [DynamicMapLayer](https://developers.arcgis.com/javascript/latest/references/core/rest/layerSources/DynamicMapLayer/) * and adding it to the [source](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/#source) property of the sublayer, the value of this * property can be anything set by the developer. * * @see [Sample - MapImageLayer: toggle sublayer visibility](https://developers.arcgis.com/javascript/latest/sample-code/layers-mapimagelayer-sublayers/) * @example * // Creates a MapImageLayer instance containing only the sublayers defined below. * let layer = new MapImageLayer({ * url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer", * // this service has four sublayers, but we're only going to include three. * sublayers: [ { id: 2 }, { id: 1 }, { id: 0 } ] * }); * @example * // Creates a MapImageLayer instance containing only the sublayers defined below. * let layer = new MapImageLayer({ * url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer", * sublayers: [{ // sets a new renderer on this sublayer * id: 2, * renderer: { * type: "class-breaks" // autocasts as new ClassBreaksRenderer() * // set renderer properties here * } * }, { // sets new labelingInfo on the sublayer * id: 1, * labelingInfo: [ new LabelClass( ... ) ] * }, { // retains properties defined by the service, but makes sublayer not visible * id: 0, * visible: false * }] * }); */ accessor id: number; /** * Returns `true` if the sublayer is a non-spatial table in a map service. * * @default false * @since 4.30 * @see [MapImageLayer.subtables](https://developers.arcgis.com/javascript/latest/references/core/layers/MapImageLayer/#subtables) * @see [TileLayer.subtables](https://developers.arcgis.com/javascript/latest/references/core/layers/TileLayer/#subtables) */ get isTable(): boolean; /** * The label definition for this layer, * specified as an array of [LabelClass](https://developers.arcgis.com/javascript/latest/references/core/layers/support/LabelClass/) objects. * Use this property to specify labeling properties for the layer such as label expression, placement, and size. * * @see [Sample - MapImageLayer: label sublayer features](https://developers.arcgis.com/javascript/latest/sample-code/layers-mapimagelayer-dynamic-labels/) * @example * let layer = new MapImageLayer({ * url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer", * sublayers: [{ * id: 3, * labelsVisible: true, * // labelingInfo autocasts to an array of LabelClass objects * labelingInfo: [{ * labelExpression: "[name]", * labelPlacement: "always-horizontal", * symbol: { * type: "text", // autocasts as new TextSymbol() * color: [255, 255, 255, 0.7], * haloColor: [0, 0, 0, 0.85], * haloSize: 1, * font: { * size: 11 * } * }, * minScale: 2400000, * maxScale: 73000 * }] * }] * }); */ get labelingInfo(): LabelClass[] | null | undefined; set labelingInfo(value: LabelClassProperties[] | null | undefined); /** * Indicates if labels for the sublayer will be visible in the view. * * @default true * @see [Sample - MapImageLayer: label sublayer features](https://developers.arcgis.com/javascript/latest/sample-code/layers-mapimagelayer-dynamic-labels/) * @example * // turns on labels defined for sublayer 0 * layer.findSublayerById(0).labelsVisible = true; */ accessor labelsVisible: boolean; /** The [MapImageLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/MapImageLayer/) or [TileLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/TileLayer/) to which the sublayer belongs. */ accessor layer: MapImageLayer | TileLayer | null | undefined; /** * Indicates whether the layer will be included in the legend. When `false`, the layer will be excluded from the legend. * * @default true */ accessor legendEnabled: boolean; /** * Indicates how the layer should display in the [LayerList](https://developers.arcgis.com/javascript/latest/references/core/widgets/LayerList/) widget. * The possible values are listed below. * * Value | Description * ------|------------ * show | The layer is visible in the table of contents. * hide | The layer is hidden in the table of contents. * hide-children | Hide the children layers from the table of contents. * * @default "show" * @since 4.11 */ accessor listMode: "hide" | "show" | "hide-children"; /** * 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](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/#minScale) value, * and greater than or equal to the service specification. * * @see [Sample - MapImageLayer - label sublayer features](https://developers.arcgis.com/javascript/latest/sample-code/layers-mapimagelayer-dynamic-labels/) * @example * let layer = new MapImageLayer({ * url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer", * sublayers: [ * { * id: 0, * minScale: 5000000, * maxScale: 24000 * }, * { * id: 1 * minScale: 24000, * maxScale: 100 * } * ] * }); */ accessor maxScale: 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](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/#maxScale) value, * and lesser than or equal to the service specification. * * @see [Sample - MapImageLayer - label sublayer features](https://developers.arcgis.com/javascript/latest/sample-code/layers-mapimagelayer-dynamic-labels/) * @example * let layer = new MapImageLayer({ * url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer", * sublayers: [ * { * id: 0, * minScale: 5000000, * maxScale: 24000 * }, * { * id: 1, * minScale: 24000, * maxScale: 100 * } * ] * }); */ accessor minScale: number; /** * The name of an `oid` [field](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/#fields) containing a unique value or identifier for each * feature in the Sublayer. * * @since 4.15 * @see [fields](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/#fields) * @see [load()](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/#load) */ get objectIdField(): string | null | undefined; /** * The level of opacity to set on the sublayer on a scale * from 0.0 - 1.0 where `0` is fully transparent and `1.0` is fully opaque. * If the [MapImageLayer.opacity](https://developers.arcgis.com/javascript/latest/references/core/layers/MapImageLayer/#opacity) * is set, the actual opacity value of the sublayer will be the value of * [MapImageLayer.opacity](https://developers.arcgis.com/javascript/latest/references/core/layers/MapImageLayer/#opacity) multiplied * by the sublayer's opacity. * * @see [Sample - MapImageLayer: dynamic data layer with table join](https://developers.arcgis.com/javascript/latest/sample-code/layers-dynamicdatalayer-table-join/) * @example * // Set the opacity of the layer to 0.5 * layer.findSublayerById(0).opacity = 0.5; */ accessor opacity: number; /** * Determines the order in which features are drawn in the view. You * can sort features by a field value or the value returned from an * [Arcade](https://developers.arcgis.com/javascript/latest/arcade/) expression in ascending or descending order. * * When `null` (default), features are drawn in the order they are returned from * the service or client. * * > [!WARNING] * > * > **Known Limitations** * > * > - Feature drawing order configurations defined with Arcade expressions cannot be [saved](https://developers.arcgis.com/javascript/latest/references/core/WebMap/#save) to web maps. * > - Currently, you can only sort features by one field or expression. * > - This property cannot be [saved](https://developers.arcgis.com/javascript/latest/references/core/WebScene/#save) to a web scene. * * @since 4.32 * @see [Arcade Feature Z Profile](https://developers.arcgis.com/javascript/latest/arcade/#feature-sorting) * @example * // Features with larger population values will * // be rendered on top of smaller features. * sublayer.orderBy = [ * { * field: "POP2024", * order: "descending" * } * ]; */ get orderBy(): OrderByInfo[] | null | undefined; set orderBy(value: OrderByInfoProperties[] | null | undefined); /** * The parent layer to which the sublayer belongs. * * @since 4.27 */ accessor parent: Sublayer | MapImageLayer | TileLayer | null | undefined; /** * Indicates whether to display popups when features in the layer are clicked. The layer needs to have a * [popupTemplate](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/#popupTemplate) to define what information should be displayed in the popup. Alternatively, * a default popup template may be automatically used if * [Popup.defaultPopupTemplateEnabled](https://developers.arcgis.com/javascript/latest/references/core/widgets/Popup/#defaultPopupTemplateEnabled) is set to `true`. * * @default true * @since 4.7 */ accessor popupEnabled: boolean; /** * The popup template for the sublayer. When set, the `popupTemplate` * allows users to access attributes and display their values in the * view's Popup when the user clicks * the image. * * Sublayers with a [RasterDataSource](https://developers.arcgis.com/javascript/latest/references/core/rest/layerSources/RasterDataSource/) cannot be queried and * therefore do not support [PopupTemplate](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/). * * Alternatively, a default popup template may be automatically used if * [Popup.defaultPopupTemplateEnabled](https://developers.arcgis.com/javascript/latest/references/core/widgets/Popup/#defaultPopupTemplateEnabled) is set to `true`. * * > [!WARNING] * > * > **Known Limitations** * > * > [Arcade](https://developers.arcgis.com/javascript/latest/arcade/) expressions * > are not supported in PopupTemplates set on MapImageLayer sublayers or TileLayer sublayers * > unless they reference ArcGIS Enterprise 10.6 map services (or later) created from ArcGIS Pro. * * @see [Sample - MapImageLayer: dynamic data layer with table join](https://developers.arcgis.com/javascript/latest/sample-code/layers-dynamicdatalayer-table-join/) * @example * let layer = new MapImageLayer({ * url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer", * sublayers: [{ * id: 0, * popupTemplate: { * title: "{COUNTY}", * content: "{POP2007} people lived in this county in 2007" * } * }] * }); */ get popupTemplate(): PopupTemplate | null | undefined; set popupTemplate(value: PopupTemplateProperties | null | undefined); /** * An array of [relationships](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Relationship/) associated with the sublayer. * Each [Relationship](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Relationship/) defines a _relationship_ between this sublayer and another layer or table. * * @since 4.30 */ get relationships(): Relationship[] | null | undefined; /** * The renderer to apply to the sublayer. * This value overrides the renderer read from the map service. * To see if you can use this property, check the * `supportsDynamicLayers` property of * [MapImageLayer.capabilities](https://developers.arcgis.com/javascript/latest/references/core/layers/MapImageLayer/#capabilities). * * > [!WARNING] * > * > **Known Limitations** * > * > [3D symbols](https://developers.arcgis.com/javascript/latest/references/core/symbols/Symbol3D/) are not currently supported in * > renderers set on sublayers. * > [Visual variables](https://developers.arcgis.com/javascript/latest/references/core/renderers/SimpleRenderer/#visualVariables) and * > [Arcade](https://developers.arcgis.com/javascript/latest/arcade/) expressions * > are not supported in renderers set on MapImageLayer sublayers * > unless they reference ArcGIS Enterprise 10.6 map services (or later) created from ArcGIS Pro. * * @see [Sample - MapImageLayer: set renderers on sublayers](https://developers.arcgis.com/javascript/latest/sample-code/layers-mapimagelayer-renderers/) * @example * let layer = new MapImageLayer({ * url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer", * sublayers: [{ * id: 0, * renderer: { * type: "simple", // autocasts as new SimpleRenderer() * symbol: { * type: "simple-marker", // autocasts as new SimpleMarkerSymbol() * color: "black", * size: 8 * } * } * }] * }); */ get renderer(): RendererUnion | null | undefined; set renderer(value: (((SimpleRendererProperties & { type: "simple" }) | (ClassBreaksRendererProperties & { type: "class-breaks" }) | (UniqueValueRendererProperties & { type: "unique-value" }) | (DotDensityRendererProperties & { type: "dot-density" }) | (DictionaryRendererProperties & { type: "dictionary" }) | (PieChartRendererProperties & { type: "pie-chart" })) | (HeatmapRendererProperties & { type: "heatmap" })) | null | undefined); /** * An object that allows you to create a dynamic layer with data * either from the map service sublayers or data from a registered workspace. * See [DynamicMapLayer](https://developers.arcgis.com/javascript/latest/references/core/rest/layerSources/DynamicMapLayer/) * for creating dynamic layers from map service layers for on the fly * rendering, labeling, and filtering (definition expressions). To create * dynamic layers from other sources in registered workspaces such as tables and table joins, * see [DynamicDataLayer](https://developers.arcgis.com/javascript/latest/references/core/rest/layerSources/DynamicDataLayer/). * * @example * // Creates two sublayers that point to the same map service layer. * // Each layer presents different features in the data using * // definition expressions and renderers. * let mapImageLayer = new MapImageLayer({ * sublayers: [{ * id: 10, * definitionExpression: "POP < 100000", * renderer: { * type: "simple", // autocasts as new SimpleRenderer() * symbol: smallMarker * }, * source: { * type: "map-layer", * mapLayerId: 0 * } * }, { * id: 11, * definitionExpression: "POP > 100001", * renderer: { * type: "simple", // autocasts as new SimpleRenderer() * symbol: largeMarker * }, * source: { * type: "map-layer", * mapLayerId: 0 * } * }] * }); */ get source(): DynamicMapLayer | DynamicDataLayer; set source(value: (DynamicMapLayerProperties & { type: "map-layer" }) | (DynamicDataLayerProperties & { type: "data-layer" })); /** * The [map service's metadata JSON](https://developers.arcgis.com/rest/services-reference/map-service.htm) * exposed by the ArcGIS REST API. While most commonly used properties * are exposed on the Sublayer class directly, this property gives access to all information returned * by the map service. This property is useful if working in an application built using an older version of the API * which requires access to map service properties from a more recent version. * * @since 4.15 */ accessor sourceJSON: any | null | undefined; /** * The [spatial reference](https://developers.arcgis.com/javascript/latest/references/core/geometry/SpatialReference/) of the sublayer as defined by the service. * * @since 4.30 */ get spatialReference(): SpatialReference | null | undefined; /** * If a sublayer contains sublayers, this * property is a [Collection](https://developers.arcgis.com/javascript/latest/references/core/core/Collection/) of [Sublayer](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/) * objects belonging to the given sublayer with sublayers. * * @example * // test function for determining if a MapImageLayer's sublayers * // contain at least one dynamic data layer * function hasDynamicDataLayer (layer){ * if (layer.sublayers && layer.sublayers.sublayers){ * return layer.sublayers.sublayers.some(function(sublayer){ * return sublayer.source.type === "data-layer"; * }); * } else { * console.log("layer does not have sublayers or nested sublayers"); * return false; * } * } */ get sublayers(): Collection<Sublayer>; set sublayers(value: ReadonlyArrayOrCollection<SublayerProperties>); /** * The title of the sublayer used to identify it in places such as the * [LayerList](https://developers.arcgis.com/javascript/latest/references/core/widgets/LayerList/) and [Legend](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-legend/). * This value can be defined in the map service or programmatically * by the developer. It can also be useful for finding a specific * sublayer. * * @example * let radarSublayer = layer.sublayers.find(function(sublayer){ * return sublayer.title === "radar"; * }); */ accessor title: string | null | undefined; get type(): "sublayer"; /** * The name of the field holding the type ID or subtypes for the features. * See [ArcGIS Pro subtypes document](https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/an-overview-of-subtypes.htm). * This property is only available after the Sublayer has been [loaded](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/#loadStatus). * * @since 4.15 * @see [load()](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/#load) */ get typeIdField(): string | null | undefined; /** * An array of [types](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureType/) defined in the feature service exposed by ArcGIS REST API. * Each item includes information about the type, such as the type ID, name, and definition expression. * This property is only available after the Sublayer has been [loaded](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/#loadStatus). * * @since 4.15 * @see [load()](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/#load) */ get types(): FeatureType[] | null | undefined; /** * The URL to the REST endpoint of the sublayer. This allows * you to view the schema of fields and query tables located * in registered workspaces. */ accessor url: string | null | undefined; /** * Indicates if the layer is visible in the view. * To see if you can use this property, check the * `supportsSublayerVisibility` property of * [MapImageLayer.capabilities](https://developers.arcgis.com/javascript/latest/references/core/layers/MapImageLayer/#capabilities). * * @see [Sample - MapImageLayer: toggle sublayer visibility](https://developers.arcgis.com/javascript/latest/sample-code/layers-mapimagelayer-sublayers/) * @example * let layer = new MapImageLayer({ * url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer", * sublayers: [{ * // this sublayer is visible by default * id: 0 * }, { * // this sublayer will be added to the layer but not visible * id: 1, * visible: false * }] * // all other sublayers in the service are excluded from the layer * }); */ accessor visible: boolean; /** * Creates a deep clone of the sublayer. * * @returns A deep clone of the sublayer * instance that invoked this