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: string
An 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): HostedLayer
Add layers to a maplibre map.
Parameters
Parameter | Type | Notes |
---|---|---|
map | Map$1 | A maplibre map object |
Returns
HostedLayer
addSourcesAndLayersTo
Class MethodaddSourcesAndLayersTo(map: Map$1): HostedLayer
Convenience method that adds all associated Maplibre sources and data layers to a map.
Parameters
Parameter | Type | Notes |
---|---|---|
map | Map$1 |
Returns
HostedLayer
addSourcesTo
Class MethodaddSourcesTo(map: Map$1): HostedLayer
Parameters
Parameter | Type |
---|---|
map | Map$1 |
Returns
HostedLayer
copyLayer
Class MethodcopyLayer(layerId: string): LayerSpecification
Returns a mutable copy of the specified layer
Parameters
Parameter | Type | Notes |
---|---|---|
layer | string | The ID of the maplibre style layer to copy |
Returns
LayerSpecification
copySource
Class MethodcopySource(sourceId: string): SupportedSourceSpecification
Returns a mutable copy of the specified source.
Parameters
Parameter | Type | Notes |
---|---|---|
source | string | The ID of the maplibre style source to copy. |
Returns
SupportedSourceSpecification
initialize
initialize(): Promise<HostedLayer>
Initializes the layer with data from ArcGIS. Called to instantiate a class.
Returns
Promise<HostedLayer>