Skip to content

HostedLayer

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

PropertyTypeNotes
tokenstring

An ArcGIS access token is required for accessing secure data layers. To get a token, go to the Security and Authentication Guide.

token

Class Property
token: string

An ArcGIS access token is required for accessing secure data layers. To get a token, go to the Security and Authentication Guide.

Accessors

AccessorReturns
layer()Readonly<LayerSpecification>
layers()readonlyLayerSpecification[]
source()Readonly<SupportedSourceSpecification>
sourceId()string
sources()Readonly<{}>

layer

Class Accessor
layer(): Readonly<LayerSpecification>

Retrieves the layer for the hosted layer.

Returns 
Readonly<LayerSpecification>

layers

Class Accessor
layers(): readonlyLayerSpecification[]

Retrieves the layers for the hosted layer.

Returns 
readonlyLayerSpecification[]

source

Class Accessor
source(): Readonly<SupportedSourceSpecification>

Retrieves the source for the hosted layer.

Returns 
Readonly<SupportedSourceSpecification>

sourceId

Class Accessor
sourceId(): string

Retrieves the source ID for the hosted layer.

Returns 
string

sources

Class Accessor
sources(): Readonly<{}>

Retrieves the sources for the hosted layer.

Returns 
Readonly<{}>

Methods

MethodReturnsNotes
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 Method
addLayersTo(mapMap$1): HostedLayer

Add layers to a maplibre map.

Parameters
ParameterTypeNotes
mapMap$1

A maplibre map object

Returns 
HostedLayer

addSourcesAndLayersTo

Class Method
addSourcesAndLayersTo(mapMap$1): HostedLayer

Convenience method that adds all associated Maplibre sources and data layers to a map.

Parameters
ParameterTypeNotes
mapMap$1

A MapLibre GL JS map

Returns 
HostedLayer

addSourcesTo

Class Method
addSourcesTo(mapMap$1): HostedLayer
Parameters
ParameterType
mapMap$1
Returns 
HostedLayer

copyLayer

Class Method
copyLayer(layerIdstring): LayerSpecification

Returns a mutable copy of the specified layer

Parameters
ParameterTypeNotes
layerIdstring

The ID of the maplibre style layer to copy

Returns 
LayerSpecification

copySource

Class Method
copySource(sourceIdstring): SupportedSourceSpecification

Returns a mutable copy of the specified source.

Parameters
ParameterTypeNotes
sourceIdstring

The ID of the maplibre style source to copy.

Returns 
SupportedSourceSpecification

initialize

abstract
Class Method
initialize(): Promise<HostedLayer>

Initializes the layer with data from ArcGIS. Called to instantiate a class.

Returns 
Promise<HostedLayer>

setAttribution

Class Method
setAttribution(sourceIdstring, attributionstring): void

Sets the data attribution of the specified source

Parameters
ParameterTypeNotes
sourceIdstring

The ID of the maplibre style source.

attributionstring

Custom attribution text.

Returns 
void

setSourceId

Class Method
setSourceId(oldIdstring, newIdstring): void

Changes the ID of a maplibre style source, and updates all associated maplibre style layers.

Parameters
ParameterTypeNotes
oldIdstring

The source ID to be changed.

newIdstring

The new source ID.

Returns 
void

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.