Class
Abstract class representing a hosted layer for MapLibre GL JS.
This class provides a common base for loading data hosted in ArcGIS, such as feature layers and vector tile layers. It cannot be instantiated directly.
It includes methods for managing authentication, sources, layers, and adding them to a MapLibre map.
Subclasses must implement the initialize method to load data from ArcGIS.
Properties
| Property | Type | Notes |
|---|---|---|
token | string | An ArcGIS access token is required for accessing secure data layers. To get a token, go to the Security and Authentication Guide. |
token
Class Propertytoken: stringAn ArcGIS access token is required for accessing secure data layers. To get a token, go to the Security and Authentication Guide.
Accessors
| Accessor | Returns |
|---|---|
layer() | Readonly<LayerSpecification> |
layers() | readonlyLayerSpecification[] |
source() | Readonly<SupportedSourceSpecification> |
sourceId() | string |
sources() | Readonly<{}> |
layer
Class Accessorlayer(): Readonly<LayerSpecification>Retrieves the layer for the hosted layer.
Returns
Readonly<LayerSpecification>layers
Class Accessorlayers(): readonlyLayerSpecification[]Retrieves the layers for the hosted layer.
Returns
readonlyLayerSpecification[]source
Class Accessorsource(): Readonly<SupportedSourceSpecification>Retrieves the source for the hosted layer.
Returns
Readonly<SupportedSourceSpecification>Methods
| Method | Returns | Notes |
|---|---|---|
addLayersTo(map) | HostedLayer | Add layers to a maplibre map. |
addSourcesAndLayersTo(map) | HostedLayer | Convenience method that adds all associated Maplibre sources and data layers to a map. |
addSourcesTo(map) | HostedLayer | |
copyLayer(layerId) | LayerSpecification | Returns a mutable copy of the specified layer |
copySource(sourceId) | SupportedSourceSpecification | Returns a mutable copy of the specified source. |
initialize() | Promise<HostedLayer> | Initializes the layer with data from ArcGIS. Called to instantiate a class. |
setAttribution(sourceId, attribution) | void | Sets the data attribution of the specified source |
setSourceId(oldId, newId) | void | Changes the ID of a maplibre style source, and updates all associated maplibre style layers. |
addLayersTo
Class MethodaddLayersTo(map: Map$1): HostedLayerAdd layers to a maplibre map.
Parameters
| Parameter | Type | Notes |
|---|---|---|
map | Map$1 | A maplibre map object |
Returns
HostedLayeraddSourcesAndLayersTo
Class MethodaddSourcesAndLayersTo(map: Map$1): HostedLayerConvenience method that adds all associated Maplibre sources and data layers to a map.
Parameters
| Parameter | Type | Notes |
|---|---|---|
map | Map$1 |
Returns
HostedLayeraddSourcesTo
Class MethodaddSourcesTo(map: Map$1): HostedLayerParameters
| Parameter | Type |
|---|---|
map | Map$1 |
Returns
HostedLayercopyLayer
Class MethodcopyLayer(layerId: string): LayerSpecificationReturns a mutable copy of the specified layer
Parameters
| Parameter | Type | Notes |
|---|---|---|
layer | string | The ID of the maplibre style layer to copy |
Returns
LayerSpecificationcopySource
Class MethodcopySource(sourceId: string): SupportedSourceSpecificationReturns a mutable copy of the specified source.
Parameters
| Parameter | Type | Notes |
|---|---|---|
source | string | The ID of the maplibre style source to copy. |
Returns
SupportedSourceSpecificationinitialize
initialize(): Promise<HostedLayer>Initializes the layer with data from ArcGIS. Called to instantiate a class.
Returns
Promise<HostedLayer>