import BasemapGalleryModel from "@arcgis/core/basemapGallery/BasemapGalleryModel.js";
Inheritance
BasemapGalleryModel→Accessor
Since
ArcGIS Maps SDK for JavaScript 5.2

Provides the logic for displaying and selecting a collection of basemaps.

See also

Constructors

Constructor

Constructor

Parameters

ParameterTypeDescriptionRequired
properties
See the properties table for a list of all the properties that may be passed into the constructor.

Properties

Any properties can be set, retrieved or listened to. See the Watch for changes topic.

activeBasemap

autocast Property
Type
Basemap | null

The map's Map.basemap.

activeBasemapIndex

readonly Property
Type
number

The current index of the active Map.basemap.

compatibilityFunction

autocast Property
Type
BasemapCompatibilityFunction

Function used to determine whether a basemap is compatible with the current view. This is mostly needed for SceneView.

declaredClass

readonlyinherited Property
Type
string
Inherited from: Accessor
Since
ArcGIS Maps SDK for JavaScript 4.7

The name of the class. The declared class name is formatted as esri.folder.className.

items

readonly Property
Type
Collection<BasemapItem>

A collection of items representing basemaps.

loadError

readonlyinherited Property
Type
EsriError | null | undefined
Inherited from: LoadableMixin

The Error object returned if an error occurred while loading.

loading

readonly Property
Type
boolean

Indicates whether any basemap item in the collection is loading.

Default value
false

loadStatus

readonlyinherited Property
Type
"not-loaded" | "loading" | "failed" | "loaded"
Inherited from: LoadableMixin

Represents the status of a load() operation.

ValueDescription
not-loadedThe object's resources have not loaded.
loadingThe object's resources are currently loading.
loadedThe object's resources have loaded without errors.
failedThe object's resources failed to load. See loadError for more details.
Default value
"not-loaded"

loadWarnings

readonlyinherited Property
Type
any[]
Inherited from: LoadableMixin

A list of warnings which occurred while loading.

source

autocast Property
Type
LocalBasemapsSource | PortalBasemapsSource

The source for basemaps that the gallery will display. This property can be autocast with an array or Collection of Basemaps, or a Portal instance. The default source is a PortalBasemapsSource.

view

Property
Type
MapViewOrSceneView | null | undefined

The view from which the Basemap Gallery will operate. This view provides access to the active Map.basemap through the view's View.map property.

Methods

MethodSignatureClass
basemapEquals(basemap1: Basemap | null | undefined, basemap2: Basemap | null | undefined): boolean
inherited
cancelLoad(): this
destroy(): void
inherited
isFulfilled(): boolean
inherited
isRejected(): boolean
inherited
isResolved(): boolean
load(): Promise<this>
refresh(): void
inherited
when<TResult1 = this, TResult2 = never>(onFulfilled?: OnFulfilledCallback<this, TResult1> | null | undefined, onRejected?: OnRejectedCallback<TResult2> | null | undefined): Promise<TResult1 | TResult2>

basemapEquals

Method
Signature
basemapEquals (basemap1: Basemap | null | undefined, basemap2: Basemap | null | undefined): boolean

A convenience function to check basemap equality.

Parameters

ParameterTypeDescriptionRequired
basemap1

The basemap to compare against basemap2.

basemap2

The basemap to compare against basemap1.

Returns
boolean

Returns true if both basemaps are equal, false otherwise.

cancelLoad

inherited Method
Signature
cancelLoad (): this
Inherited from: LoadableMixin

Cancels a load() operation if it is already in progress.

Returns
this

destroy

Method
Signature
destroy (): void

Destroys the basemap collection.

Returns
void

isFulfilled

inherited Method
Signature
isFulfilled (): boolean
Inherited from: EsriPromiseMixin

isFulfilled() may be used to verify whether the promise has been fulfilled (either resolved or rejected).

Returns
boolean

Whether the promise has been fulfilled (either resolved or rejected).

isRejected

inherited Method
Signature
isRejected (): boolean
Inherited from: EsriPromiseMixin

isRejected() may be used to verify whether the promise has been rejected.

Returns
boolean

Whether the promise has been rejected.

isResolved

inherited Method
Signature
isResolved (): boolean
Inherited from: EsriPromiseMixin

isResolved() may be used to verify whether the promise has resolved.

Returns
boolean

Whether the promise has resolved.

load

Method
Signature
load (): Promise<this>

Loads the current basemap source.

Returns
Promise<this>

A promise that resolves with this collection when the source has loaded.

refresh

Method
Signature
refresh (): void

Refreshes the collection of basemap items.

Returns
void

when

inherited Method
Signature
when <TResult1 = this, TResult2 = never>(onFulfilled?: OnFulfilledCallback<this, TResult1> | null | undefined, onRejected?: OnRejectedCallback<TResult2> | null | undefined): Promise<TResult1 | TResult2>
Type parameters
<TResult1 = this, TResult2 = never>
Inherited from: EsriPromiseMixin
Since
ArcGIS Maps SDK for JavaScript 4.6

when() may be used with an instance of this class. This method takes two input parameters: an onFulfilled function and an onRejected function. The onFulfilled function executes when the promise resolves. The onRejected function executes if the promise is rejected.

Parameters

ParameterTypeDescriptionRequired
onFulfilled

The function to call when the promise resolves.

onRejected

The function to execute when the promise fails.

Returns
Promise<TResult1 | TResult2>

Returns a new promise for the result of onFulfilled that may be used to chain additional functions.

Example
// Although this example uses MapView, any class instance that is a promise may use when() in the same way
let view = new MapView();
view.when(function(){
// This function will execute once the promise is resolved
}, function(error){
// This function will execute if the promise is rejected due to an error
});