@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
525 lines (517 loc) • 42.8 kB
TypeScript
import type Ground from "../Ground.js";
import type Basemap from "../Basemap.js";
import type Map from "../Map.js";
import type Extent from "../geometry/Extent.js";
import type CatalogLayer from "./CatalogLayer.js";
import type GroupLayer from "./GroupLayer.js";
import type CatalogDynamicGroupLayer from "./catalog/CatalogDynamicGroupLayer.js";
import type PortalItem from "../portal/PortalItem.js";
import type TimeExtent from "../time/TimeExtent.js";
import type View from "../views/View.js";
import type LayerView from "../views/layers/LayerView.js";
import type { EventedMixin } from "../core/Evented.js";
import type { IdentifiableMixin, IdentifiableMixinProperties } from "../core/Identifiable.js";
import type { Loadable, LoadableMixinProperties } from "../core/Loadable.js";
import type { AbortOptions } from "../core/promiseUtils.js";
import type { LayerType, LayerListMode } from "./types.js";
import type { ExtentProperties } from "../geometry/Extent.js";
import type { TimeExtentProperties } from "../time/TimeExtent.js";
export interface LayerProperties extends LoadableMixinProperties, IdentifiableMixinProperties, Partial<Pick<Layer, "id" | "listMode" | "opacity" | "parent" | "title" | "visible">> {
/**
* The full extent of the layer. By default, this is worldwide. This property may be used
* to set the extent of the view to match a layer's extent so that its features
* appear to fill the view. See the sample snippet below.
*
* > [!NOTE]
* > The `fullExtent` property is always `null` for [GroupLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GroupLayer/).
*
* @example
* // Once the layer loads, set the view's extent to the layer's full extent
* layer.when(function(){
* view.extent = layer.fullExtent;
* });
*/
fullExtent?: ExtentProperties | null;
/**
* Specifies a fixed [time extent](https://developers.arcgis.com/javascript/latest/references/core/time/TimeExtent/) during which a layer should be visible. This property can be used to configure a layer that does not have time values
* stored in an attribute field to work with time. Once configured, the [TimeSlider](https://developers.arcgis.com/javascript/latest/references/core/widgets/TimeSlider/) widget will display the layer within the set time extent.
* In the case that only one of the [TimeExtent.start](https://developers.arcgis.com/javascript/latest/references/core/time/TimeExtent/#start) or [TimeExtent.end](https://developers.arcgis.com/javascript/latest/references/core/time/TimeExtent/#end) date values are available,
* the layer remains visible indefinitely in the direction where there is no time value.
*
* Aerial imagery can capture seasonal variations in vegetation, water bodies, and land use patterns. For example, in agricultural regions, aerial imageries taken during
* different growing seasons provide insights into crop health and productivity. Defining a fixed time extent on imageries from specific time periods provides temporal context
* and facilitates focused analysis based on specific time periods or events.
*
* @since 4.30
* @see [Sample - GraphicsLayer with visibilityTimeExtent](https://developers.arcgis.com/javascript/latest/sample-code/layers-graphics-visibilitytimeextent/)
*/
visibilityTimeExtent?: TimeExtentProperties | null;
}
export interface FromArcGISServerUrlParameters {
/** The ArcGIS Server URL used to create the layer. */
url: string;
/**
* Set any of the layer's properties here
* for constructing the layer instance (e.g. popupTemplate, renderer, etc.).
*/
properties?: Record<string, unknown>;
}
/**
* The layer is the most fundamental component of a [Map](https://developers.arcgis.com/javascript/latest/references/core/Map/). It is a collection of spatial data
* in the form of vector graphics, raster images, or 3D objects that represent real-world phenomena. Layers may contain
* discrete features that store vector data or continuous cells/pixels that store raster data.
*
* In the case of vector-based layers, such as [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/) and
* [GraphicsLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GraphicsLayer/), each feature
* contained in the layer has a [Geometry](https://developers.arcgis.com/javascript/latest/references/core/geometry/Geometry/)
* that allows it to be rendered as a [Graphic](https://developers.arcgis.com/javascript/latest/references/core/Graphic/) with spatial context on
* the [View](https://developers.arcgis.com/javascript/latest/references/core/views/View/).
* Features within the layer also contain data [Graphic.attributes](https://developers.arcgis.com/javascript/latest/references/core/Graphic/#attributes) that
* provide additional information, which may be viewed in [Popup](https://developers.arcgis.com/javascript/latest/references/core/widgets/Popup/) windows
* and used for [rendering](https://developers.arcgis.com/javascript/latest/references/core/renderers/Renderer/) the layer.
*
* To create a layer you must use one of the subclasses of Layer or call the
* [fromPortalItem()](https://developers.arcgis.com/javascript/latest/references/core/layers/Layer/#fromPortalItem) method. A few examples
* of layers include the following:
*
* * Roads and highways may be represented using linear features in a [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/)
* * Land parcels can be displayed as polygons in a [MapImageLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/MapImageLayer/)
* * Satellite imagery may be displayed as tiled images in a [TileLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/TileLayer/)
*
* Multiple layers may be added to the same map and overlaid on top of one another for visualization
* and analytical purposes. See [Map](https://developers.arcgis.com/javascript/latest/references/core/Map/) for additional information regarding how to
* [add layers](https://developers.arcgis.com/javascript/latest/references/core/Map/#add) to a map. Layers are rendered in the [View](https://developers.arcgis.com/javascript/latest/references/core/views/View/) with a [LayerView](https://developers.arcgis.com/javascript/latest/references/core/views/layers/LayerView/).
*
* In a broad sense, layers can be used for the following purposes:
* * Displaying location for geographic context
* * Querying data
* * Displaying categorical and/or numeric data
* * Analytics
*
* All layer types inherit from Layer. To learn more about each
* layer type, comparing and contrasting their data sources and capabilities, see the
* table below.
*
* <span id="layer-types"></span>
*
* ### Layers for querying, visualizing, analyzing data
*
* Layer type | Data source | Data types | Features | Limitations
* -----------|-------------|------------|----------|------------
* [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/) | ArcGIS FeatureServer/MapServer, ArcGIS portal item, or client-side graphics | Points, polylines, polygons downloaded as vector graphics | Client-side processing, popup templates, renderers with 2D and 3D symbols, querying, editing (in a future release) | Limited number of features for display; may require large download depending on number of features
* [GraphicsLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GraphicsLayer/) | Client-side graphics | Points, polylines, polygons displayed as vector graphics | No geometry schema. Points, polylines and polygons may be stored in a single layer. | No renderer nor popup templates; visualization and popup templates are handled on a graphic-by-graphic basis.
* [MapImageLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/MapImageLayer/) | ArcGIS MapServer, ArcGIS portal item | Points, polylines, polygons, rasters exported in a single image | May contain nested sublayers. Server-side processing of renderers, popup templates, opacity, and labels for fast display of many features. May be used to display, query, and join data in registered workspaces | No editing support
* [SceneLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/SceneLayer/) | ArcGIS SceneServer, ArcGIS portal item | Point and multipatch geometries | Can display a large number of features on the client. Ideal for rendering 3D features | No 2D support; editing via associated feature layer
* [CSVLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/CSVLayer/) | CSV file | Points downloaded as vector graphics | Client-side processing, popup templates, renderers with 2D and 3D symbols | May require large download depending on the number of features
* [KMLLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/KMLLayer/) | KML file (.kml, .kmz), ArcGIS portal item | Points, polylines, polygons displayed as vector graphics | Display KML file in a map or webmap | No 3D support; requires access to utility service from ArcGIS.com or ArcGIS Enterprise
* [StreamLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/StreamLayer/) | ArcGIS StreamServer | Points downloaded as vector graphics | Downloads and updates feature locations in real time | N/A
* [ImageryLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/ImageryLayer/) | ArcGIS ImageServer, ArcGIS portal item | Raster data exported as a single image | Client-side and server-side pixel filtering and rendering; popup templates; querying | N/A
* [ImageryTileLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/ImageryTileLayer/) | ArcGIS ImageServer, ArcGIS portal item | Raster data exported as a single image | Client-side rendering; popup templates | N/A
* [GeoJSONLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/) | [GeoJSON](https://geojson.org/) | Points, polylines, polygons | Renderers, labels, editing, popups | Data must comply with the RFC 7946 specification which states that the coordinates are in SpatialReference WGS84
* [OGCFeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/OGCFeatureLayer/) | [OGC API - Features](https://ogcapi.ogc.org/features/) | Points, polylines, polygons | Renderers, labels, popups | Data must comply with the RFC 7946 specification which states that the coordinates are in SpatialReference WGS84
* [GeoRSSLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoRSSLayer/) | [GeoRSS feed](https://www.ogc.org/standards/georss/) | Points, polylines, polygons | No geometry schema; popup templates | No 3D support; no support for renderers
* [DimensionLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/DimensionLayer/) | ArcGIS WebScene | [DimensionAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/DimensionAnalysis/) | Client-side length dimensions | No 2D support
* [LineOfSightLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/LineOfSightLayer/) | ArcGIS WebScene | [LineOfSightAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/LineOfSightAnalysis/) | Client-side line of sight analysis | No 2D support
* [ViewshedLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/ViewshedLayer/) | ArcGIS WebScene | [ViewshedAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/ViewshedAnalysis/) | Client-side viewsheds | No 2D support
* [MapNotesLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/MapNotesLayer/) | ArcGIS WebMap, ArcGIS portal item | Points, polylines, polygons, text | Map Notes in a webmap | No 3D support; Read-only
* [WCSLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/WCSLayer/) | WCS service | Raster data exported as a single image | OGC specification | N/A
* [WFSLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/WFSLayer/) | WFS service, ArcGIS portal item | Points, multipoints, lines, polygons | OGC specification | Data must be GeoJSON format, only support version 2.0.0
* [WMSLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/WMSLayer/) | WMS service, ArcGIS portal item | Data exported as a single image | OGC specification | N/A
* [BaseDynamicLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/BaseDynamicLayer/) | ArcGIS MapServer, WMS service | Data exported as a single image | This class may be extended to create dynamic map layers | No 3D support; exported images cannot be cached in the browser
* [BuildingSceneLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/BuildingSceneLayer/) | ArcGIS SceneServer, ArcGIS portal item | Data is organized in BuildingGroupSublayers which contain BuildingComponentSublayers | Visualize complex digital models of buildings and interact with its components | No 2D support
* [SubtypeGroupLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/) | ArcGIS FeatureServer/MapServer, ArcGIS portal item | Points, polylines, polygons downloaded as vector graphics | Contains a sublayer for each subtype in the feature service; each sublayer can be configured individually with its own renderer, popup, and labels | No 3D support; no editing support at the sublayer level
* [KnowledgeGraphLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/KnowledgeGraphLayer/) | ArcGIS KnowledgeGraphService| Data is organized in spatial and non-spatial sublayers. Spatial sublayers contain points, multipoints, lines and polygons | Contains a sublayer for each named type in the layer; each sublayer can be queried; spatial sublayers can be configured individually with their own renderer, popup, and labels| Can only be added to Map instance. Not a portal item, cannot be added to WebMap or MapViewer. Requires ArcGIS Enterprise 11.1
*
* ### Layers for providing geographic context
*
* Layer type | Data source | Data types | Features | Limitations
* -----------|-------------|------------|----------|------------
* [TileLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/TileLayer/) | ArcGIS MapServer, ArcGIS portal item | Image tiles | Better performance for large datasets; querying features | No editing, client-side rendering, or popup templates; some schema limitations in 3D views.
* [BaseTileLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/BaseTileLayer/) | ArcGIS MapServer, ArcGIS portal item | Image tiles | This class may be extended to create custom tile layers | No editing, client-side rendering, or popup templates; some schema limitations in 3D views.
* [VectorTileLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/VectorTileLayer/) | ArcGIS portal item | Points, polylines, and polygons rendered as vector tiles | Features may be styled client-side and used as a tiled basemap | No editing, client-side rendering, or popup templates.
* [IntegratedMeshLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/IntegratedMeshLayer/) or [IntegratedMesh3DTilesLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/IntegratedMesh3DTilesLayer/) | ArcGIS SceneServer, ArcGIS portal item | triangulated mesh with texture | Displays 3D objects with a high level of detail | No 2D support
* [VoxelLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/VoxelLayer/) | ArcGIS SceneServer, ArcGIS portal item | multidimensional voxel cubes | Displays multidimensional volumetric phenomena (e.g. underground models) | No 2D support
* [ElevationLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/ElevationLayer/) | ArcGIS ImageServer, ArcGIS portal item | Tiled elevation mesh/surface | Renders elevation surfaces in 3D views | No 2D support
* [BaseElevationLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/BaseElevationLayer/) | ArcGIS ImageServer, ArcGIS portal item | Tiled elevation mesh/surface | This class may be extended to create custom elevation layers | No 2D support
* [PointCloudLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/PointCloudLayer/) | ArcGIS SceneServer, ArcGIS portal item | Point clouds (e.g. collected from LiDAR) | Renderers; fast display of point clouds | No 2D support
* [OpenStreetMapLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/OpenStreetMapLayer/) | OpenStreetMap tile services | Image tiles | Displays OpenStreetMap tiled content | N/A
* [WMTSLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/WMTSLayer/) | WMTS tile services, ArcGIS portal item | Image tiles | OGC specification | N/A
* [WebTileLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/WebTileLayer/) | non-ArcGIS, non-OGC, and non-OSM tile services | Image tiles | N/A | No editing, client-side rendering, or popup templates.
* [BingMapsLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/BingMapsLayer/) | Bing Spatial Data Service data | Image tiles | Displays Microsoft's Bing tiled content | Bing Maps key is required; three map styles are supported: `road`, `aerial`, and `hybrid`
* [MediaLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/MediaLayer/) | HTMLVideoElement, HTMLImageElement, or HTMLCanvasElement | Image/video element | Displays image and video elements in the map at specified geographic locations | GIF/APNG not currently
* [VideoLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/VideoLayer/) | ArcGIS VideoServer, ArcGIS portal item | Video | Displays a georeferenced video in the map | No 3D support
*
* ### Other layers
*
* Layer type | Data source | Data types | Features | Limitations
* -----------|-------------|------------|----------|------------
* [GroupLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GroupLayer/) | Any combination of other layer types | N/A | Combines two or more layers into a single layer | N/A
*
* @since 4.0
* @see [Intro to layers](https://developers.arcgis.com/javascript/latest/sample-code/intro-layers/)
* @see [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/)
* @see [MapImageLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/MapImageLayer/)
* @see [TileLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/TileLayer/)
* @see [SceneLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/SceneLayer/)
* @see [ElevationLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/ElevationLayer/)
* @see [KnowledgeGraphLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/KnowledgeGraphLayer/)
*/
export default abstract class Layer extends LayerSuperclass {
/**
* @deprecated
* Do not directly reference this property.
* Use EventNames and EventTypes helpers from \@arcgis/core/Evented
*/
"@eventTypes": LayerEvents;
/**
* Creates a new layer instance from an ArcGIS Server URL. Depending on the URL, the returned layer type may be a [BuildingSceneLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/BuildingSceneLayer/),
* [CatalogLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/CatalogLayer/), [ElevationLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/ElevationLayer/), [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/), [GroupLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GroupLayer/), [ImageryLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/ImageryLayer/),
* [ImageryTileLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/ImageryTileLayer/), [IntegratedMeshLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/IntegratedMeshLayer/), [KnowledgeGraphLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/KnowledgeGraphLayer/),
* [MapImageLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/MapImageLayer/), [OrientedImageryLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/OrientedImageryLayer/), [PointCloudLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/PointCloudLayer/),
* [SceneLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/SceneLayer/), [StreamLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/StreamLayer/), [SubtypeGroupLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/), [TileLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/TileLayer/), or [VideoLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/VideoLayer/).
*
* This is useful when you work with various ArcGIS Server URLs, but you don't necessarily know which layer type(s) they create. This
* method creates the appropriate layer type for you. In case of a feature service or a scene service, when the URL points to the service and the service has multiple layers,
* the returned promise will resolve to a [GroupLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GroupLayer/).
*
* Beginning with version 4.17, it is possible to load tables from hosted feature services.
* This only applies to [feature layers](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/), and will successfully load if [FeatureLayer.isTable](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#isTable) returns `true`.
*
* The following table details what is returned when loading specific URL types.
*
* URL | Returns
* ------------------------|----------
* Feature service with one layer | [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/) where [FeatureLayer.isTable](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#isTable) returns `false`.
* Feature service with one table | [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/) where [FeatureLayer.isTable](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#isTable) returns `true`.
* Feature service with more than one layer(s)/table(s) | [GroupLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GroupLayer/) with layers and tables.
* Layers with type other than "Feature Layer" are discarded, e.g. Utility Network Layers | N/A
*
* @param params - Input parameters for creating the layer.
* @returns Returns a promise that resolves to the new Layer instance.
* @see [FeatureLayer.isTable](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#isTable)
* @example
* // This snippet shows how to add a feature layer from an ArcGIS Server URL
* // Get an ArcGIS Server URL from a custom function
* const arcgisUrl = getLayerUrl();
*
* Layer.fromArcGISServerUrl({
* url: arcgisUrl,
* properties: {
* // set any layer properties here
* popupTemplate: new PopupTemplate()
* }
* }).then(function(layer){
* // add the layer to the map
* map.add(layer);
* });
* @example
* // This snippet shows how to add a table from an ArcGIS Server URL
* // Get an ArcGIS Server URL from a custom function
* const arcgisUrl = getLayerUrl();
*
* Layer.fromArcGISServerUrl({
* url: arcgisUrl
* }).then(function(layer){
* // Load the table before it can be used
* layer.load().then(function() {
* // Check that it is the right type
* if (layer.isTable) {
* // Add table to map's tables collection
* map.tables.add(layer);
* }
* });
* });
*/
static fromArcGISServerUrl(params: string | FromArcGISServerUrlParameters): Promise<Layer>;
/**
* Creates a new layer instance of the appropriate layer class from an
* ArcGIS Online or ArcGIS Enterprise
* [portal item](https://developers.arcgis.com/javascript/latest/references/core/portal/PortalItem/). If the item points to
* a feature service with multiple layers, then a [GroupLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GroupLayer/)
* is created. If the item points to a service with a single layer, then it resolves
* to a layer of the same type of class as the service.
*
* > [!WARNING]
* >
* > **Note**
* > - At version 4.29, [MediaLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/MediaLayer/) can be loaded from portal items.
* > - At version 4.28, [GroupLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GroupLayer/) and [OrientedImageryLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/OrientedImageryLayer/) can be loaded from portal items.
* > - At version 4.25, [CSVLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/CSVLayer/) and [GeoJSONLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/)
* > can be loaded from CSV and GeoJSON portal items respectively.
* > - At version 4.17, it is possible to load tables from feature service items hosted in ArcGIS Online and ArcGIS Enterprise.
* > This only applies to [feature layers](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/), and will successfully load
* > if [FeatureLayer.isTable](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#isTable) returns `true`.
*
* The following table details what is returned when loading specific item types.
*
* Item(s) | Returns
* ------------------------|----------
* Feature service with one layer | [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/) where [FeatureLayer.isTable](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#isTable) returns `false`.
* Feature service with one table | [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/) where [FeatureLayer.isTable](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#isTable) returns `true`.
* Feature service with more than one layer(s)/table(s) | [GroupLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GroupLayer/) with layers and tables.
* Feature collection with one layer | [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/) where [FeatureLayer.isTable](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#isTable) returns `false`.
* Feature collection with one table | [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/) where [FeatureLayer.isTable](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#isTable) returns `true`.
* Feature collection with more than one layer(s)/table(s) | [GroupLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GroupLayer/) with layers and tables.
*
* > [!CAUTION]
* >
* > **Known Limitations**
* >
* > - This method does not currently work with [OGCFeatureServer portal items](https://developers.arcgis.com/rest/users-groups-and-items/items-and-item-types/#layers).
*
* @param params - The parameters for loading the portal item.
* @returns Returns a promise which resolves to the new layer instance.
* @see [PortalItem.isLayer](https://developers.arcgis.com/javascript/latest/references/core/portal/PortalItem/#isLayer)
* @see [FeatureLayer.isTable](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#isTable)
* @example
* // Create a layer from a specified portal item and add to the map
* Layer.fromPortalItem({
* portalItem: { // autocasts new PortalItem()
* id: "8444e275037549c1acab02d2626daaee"
* }
* }).then(function(layer){
* // add the layer to the map
* map.add(layer);
* });
* @example
* // Create a table from a specified portal item and add it to the map's tables collection
* Layer.fromPortalItem({
* portalItem: { // autocasts new PortalItem()
* id: "123f4410054b43d7a0bacc1533ceb8dc" // This is a hosted table stored in a feature service
* }
* }).then(function(layer) {
* // Necessary to load the table in order for it to be read correctly
* layer.load().then(function() {
* // Confirm this reads as a table
* if (layer.isTable) {
* // Add the new table to the map's table collection
* map.tables.add(layer);
* }
* });
* });
*/
static fromPortalItem(params: LayerFromPortalItemParameters): Promise<Layer>;
/**
* The full extent of the layer. By default, this is worldwide. This property may be used
* to set the extent of the view to match a layer's extent so that its features
* appear to fill the view. See the sample snippet below.
*
* > [!NOTE]
* > The `fullExtent` property is always `null` for [GroupLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GroupLayer/).
*
* @example
* // Once the layer loads, set the view's extent to the layer's full extent
* layer.when(function(){
* view.extent = layer.fullExtent;
* });
*/
get fullExtent(): Extent | null | undefined;
set fullExtent(value: ExtentProperties | null | undefined);
/**
* The unique ID assigned to the layer. If not set by the developer, it is automatically
* generated when the layer is loaded.
*/
accessor id: string;
/**
* Indicates how the layer should display in the [Layer List](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-layer-list/) component.
* 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 | If the layer is a [GroupLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GroupLayer/), [BuildingSceneLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/BuildingSceneLayer/), [KMLLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/KMLLayer/), [MapImageLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/MapImageLayer/), [SubtypeGroupLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/), [TileLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/TileLayer/), or [WMSLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/WMSLayer/), hide the children layers from the table of contents.
*
*
* @default "show"
*/
accessor listMode: LayerListMode;
/**
* Indicates whether the layer's resources have loaded. When `true`,
* all the properties of the object can be accessed.
*
* @default false
*/
get loaded(): boolean;
/**
* The opacity of the layer. This value can range between `1` and `0`, where `0` is 100 percent
* transparent and `1` is completely opaque.
*
* > [!WARNING]
* >
* > **Known Limitations**
* >
* > In a 3D [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/), modifying opacity is not supported for
* > [DimensionLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/DimensionLayer/),
* > [GaussianSplatLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GaussianSplatLayer/),
* > [IntegratedMesh3DTilesLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/IntegratedMesh3DTilesLayer/),
* > [IntegratedMeshLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/IntegratedMeshLayer/),
* > [LineOfSightLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/LineOfSightLayer/), [PointCloudLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/PointCloudLayer/),
* > [ViewshedLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/ViewshedLayer/), and [VoxelLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/VoxelLayer/).
*
* @default 1
* @example
* // Makes the layer 50% transparent
* layer.opacity = 0.5;
*/
accessor opacity: number;
/**
* The parent to which the layer belongs.
*
* @since 4.27
*/
accessor parent: Map | Basemap | Ground | GroupLayer | CatalogDynamicGroupLayer | CatalogLayer | null | undefined;
/**
* When `true`, the layer can be persisted. This property only has an effect for layers that are
* part of the [WebMap](https://developers.arcgis.com/javascript/latest/references/core/WebMap/) or [WebScene](https://developers.arcgis.com/javascript/latest/references/core/WebScene/) spec.
*
* @default false
* @since 4.28
*/
get persistenceEnabled(): boolean;
/**
* The title of the layer used to identify it in places such as the [Layer List](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-layer-list/) component.
*
* If the layer is loaded from a portal item, the title of the portal item will be used.
* If a layer is loaded as part of a webmap or a webscene, then the title of the layer as stored
* in the webmap/webscene will be used.
*/
accessor title: string | null | undefined;
/** The layer type provides a convenient way to check the type of the layer without the need to import specific layer modules. */
get type(): LayerType;
/**
* Specifies a fixed [time extent](https://developers.arcgis.com/javascript/latest/references/core/time/TimeExtent/) during which a layer should be visible. This property can be used to configure a layer that does not have time values
* stored in an attribute field to work with time. Once configured, the [TimeSlider](https://developers.arcgis.com/javascript/latest/references/core/widgets/TimeSlider/) widget will display the layer within the set time extent.
* In the case that only one of the [TimeExtent.start](https://developers.arcgis.com/javascript/latest/references/core/time/TimeExtent/#start) or [TimeExtent.end](https://developers.arcgis.com/javascript/latest/references/core/time/TimeExtent/#end) date values are available,
* the layer remains visible indefinitely in the direction where there is no time value.
*
* Aerial imagery can capture seasonal variations in vegetation, water bodies, and land use patterns. For example, in agricultural regions, aerial imageries taken during
* different growing seasons provide insights into crop health and productivity. Defining a fixed time extent on imageries from specific time periods provides temporal context
* and facilitates focused analysis based on specific time periods or events.
*
* @since 4.30
* @see [Sample - GraphicsLayer with visibilityTimeExtent](https://developers.arcgis.com/javascript/latest/sample-code/layers-graphics-visibilitytimeextent/)
*/
get visibilityTimeExtent(): TimeExtent | null | undefined;
set visibilityTimeExtent(value: TimeExtentProperties | null | undefined);
/**
* Indicates if the layer is visible in the [View](https://developers.arcgis.com/javascript/latest/references/core/views/View/). When `false`,
* the layer may still be added to a [Map](https://developers.arcgis.com/javascript/latest/references/core/Map/)
* instance that is referenced in a view, but its features will not be visible in the view.
*
* @default true
* @example
* // The layer is no longer visible in the view
* layer.visible = false;
*
* // Watch for changes in the layer's visibility
* // and set the visibility of another layer when it changes
* reactiveUtils.watch(
* () => layer.visible,
* (visible) => {
* if (visible) {
* anotherLayer.visible = true;
* } else {
* anotherLayer.visible = false;
* }
* }
* );
*/
accessor visible: boolean;
/**
* Called by the views, such as [MapView](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/) and
* [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/), when the layer is added to the
* [Map.layers](https://developers.arcgis.com/javascript/latest/references/core/Map/#layers) collection and a layer view must
* be created for it. **This method is used internally and there is no use case for invoking it directly**.
*
* @param view - The parent view.
* @param options - An object specifying additional options. See the
* object specification table below for the required properties of this object.
* @returns Resolves with a [LayerView](https://developers.arcgis.com/javascript/latest/references/core/views/layers/LayerView/) instance.
* @see [Sample - Custom WebGL layer view](https://developers.arcgis.com/javascript/latest/sample-code/custom-gl-visuals/)
*/
createLayerView<T extends LayerView = LayerView>(view: View<T>, options?: AbortOptions): Promise<T>;
/**
* Destroys the layer and any associated resources (including its portalItem, if it is a property on the layer).
* The layer can no longer be used once it has been destroyed.
*
* The destroyed layer will be removed from its parent object like [Map](https://developers.arcgis.com/javascript/latest/references/core/Map/), [WebMap](https://developers.arcgis.com/javascript/latest/references/core/WebMap/), [WebScene](https://developers.arcgis.com/javascript/latest/references/core/WebScene/),
* [Basemap](https://developers.arcgis.com/javascript/latest/references/core/Basemap/), [Ground](https://developers.arcgis.com/javascript/latest/references/core/Ground/), or [GroupLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GroupLayer/).
*
* @since 4.17
* @see [Map.destroy()](https://developers.arcgis.com/javascript/latest/references/core/Map/#destroy)
* @see [WebMap.destroy()](https://developers.arcgis.com/javascript/latest/references/core/WebMap/#destroy)
* @see [WebScene.destroy()](https://developers.arcgis.com/javascript/latest/references/core/WebScene/#destroy)
* @see [Basemap.destroy()](https://developers.arcgis.com/javascript/latest/references/core/Basemap/#destroy)
* @see [Ground.destroy()](https://developers.arcgis.com/javascript/latest/references/core/Ground/#destroy)
* @see [PortalItem.destroy()](https://developers.arcgis.com/javascript/latest/references/core/portal/PortalItem/#destroy)
*/
destroy(): void;
/**
* Fetches custom attribution data for the layer when it becomes available.
*
* @returns Resolves to an object containing custom attribution data for the layer.
*/
fetchAttributionData(): Promise<any>;
}
declare const LayerSuperclass: typeof Loadable & typeof IdentifiableMixin & typeof EventedMixin
export interface LayerFromPortalItemParameters {
/**
* The object representing an ArcGIS
* Online or ArcGIS Enterprise portal item from which to load the layer.
*/
portalItem: PortalItem;
}
export interface LayerEvents {
/**
* Fires after the layer's [LayerView](https://developers.arcgis.com/javascript/latest/references/core/views/layers/LayerView/) is created and rendered in a view.
*
* @see [View.whenLayerView()](https://developers.arcgis.com/javascript/latest/references/core/views/View/#whenLayerView)
* @example
* // This function will fire each time a layer view is created for this
* // particular view.
* layer.on("layerview-create", function(event){
* // The LayerView for the layer that emitted this event
* event.layerView;
* });
*/
"layerview-create": LayerLayerviewCreateEvent;
/**
* Fires when an error emits during the creation of a [LayerView](https://developers.arcgis.com/javascript/latest/references/core/views/layers/LayerView/)
* after a layer has been added to the map.
*
* @see [View.whenLayerView()](https://developers.arcgis.com/javascript/latest/references/core/views/View/#whenLayerView)
* @example
* // This function fires when an error occurs during the creation of the layer's layerview
* layer.on("layerview-create-error", function(event) {
* console.error("LayerView failed to create for layer with the id: ", layer.id, " in this view: ", event.view);
* });
*/
"layerview-create-error": LayerLayerviewCreateErrorEvent;
/** Fires after the layer's [LayerView](https://developers.arcgis.com/javascript/latest/references/core/views/layers/LayerView/) is destroyed and no longer renders in a view. */
"layerview-destroy": LayerLayerviewDestroyEvent;
}
export interface LayerLayerviewCreateEvent {
/** The view in which the `layerView` was created. */
view: View;
/**
* The LayerView rendered
* in the view representing the layer in `layer`.
*/
layerView: LayerView;
}
export interface LayerLayerviewCreateErrorEvent {
/**
* The view that failed to create a layerview for the layer
* emitting this event.
*/
view: View;
/** An error object describing why the layer view failed to create. */
error: Error;
}
export interface LayerLayerviewDestroyEvent {
/** The view in which the `layerView` was destroyed. */
view: View;
/** The destroyed LayerView representing the layer. */
layerView: LayerView;
}