PortalBasemapsSource

AMD: require(["esri/widgets/BasemapGallery/support/PortalBasemapsSource"], (PortalBasemapsSource) => { /* code goes here */ });
ESM: import PortalBasemapsSource from "@arcgis/core/widgets/BasemapGallery/support/PortalBasemapsSource";
Class: esri/widgets/BasemapGallery/support/PortalBasemapsSource
Inheritance: PortalBasemapsSource LocalBasemapsSource Accessor
Since: ArcGIS API for JavaScript 4.3

The PortalBasemapsSource class is a Portal-driven Basemap source in the BasemapGalleryViewModel or BasemapGallery widget.

See also:

Constructors

new PortalBasemapsSource(properties)
Parameter:
properties Object
optional

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

Property Overview

Any properties can be set, retrieved or listened to. See the Working with Properties topic.
Show inherited properties Hide inherited properties
Name Type Summary Class
Collection<Basemap>more details

A collection of Basemaps fetched from the source's Portal.

more detailsPortalBasemapsSource
Stringmore details

The name of the class.

more detailsAccessor
BasemapFiltermore details

Function used to filter basemaps after being fetched from the Portal.

more detailsPortalBasemapsSource
Portalmore details

The Portal from which to fetch basemaps.

more detailsPortalBasemapsSource
Object|Stringmore details

An object with key-value pairs used to create a custom basemap gallery group query.

more detailsPortalBasemapsSource
Stringmore details

The source's state.

more detailsPortalBasemapsSource
UpdateBasemapsCallbackmore details

Callback for updating basemaps after being fetched and filtered.

more detailsPortalBasemapsSource

Property Details

basemaps Collection<Basemap>

A collection of Basemaps fetched from the source's Portal.

declaredClass Stringreadonly inherited
Since: ArcGIS API for JavaScript 4.7

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

filterFunction BasemapFilter

Function used to filter basemaps after being fetched from the Portal.

portal Portal

The Portal from which to fetch basemaps.

query Object|String
Since: ArcGIS API for JavaScript 4.5

An object with key-value pairs used to create a custom basemap gallery group query. Note that all parameters will be joined using the AND operator. A query string can also be provided for more advanced use cases.

Examples:
// query portal basemaps with an object
let source = new PortalBasemapsSource({
  query: {
    title: "United States Basemaps",
    owner: "Esri_cy_US"
  }
});
// query portal basemaps with a string
let source = new PortalBasemapsSource({
  query: "title:\"United States Basemaps\" AND owner:Esri_cy_US"
});
state Stringreadonly

The source's state.

Possible Values:"not-loaded"|"loading"|"ready"

Default Value:not-loaded
updateBasemapsCallback UpdateBasemapsCallback
Since: ArcGIS API for JavaScript 4.8

Callback for updating basemaps after being fetched and filtered. This can be useful if you want to add a custom basemap after fetching the portal basemaps.

Method Overview

Name Return Type Summary Class
more details

Refreshes basemaps by fetching them from the Portal.

more detailsPortalBasemapsSource

Method Details

refresh()

Refreshes basemaps by fetching them from the Portal.

Type Definitions

BasemapFilter(item, index, array){Boolean}

This function is used by the filterFunction property to filter basemaps after they are fetched from the Portal.

Parameters:
item Basemap

The current Basemap item being assessed in the array.

index Number

The index of the Basemap being assessed.

array Basemap[]

The array of of basemaps being filtered.

Returns:
Type Description
Boolean
  • Returns true if the test passes, false otherwise.
UpdateBasemapsCallback(items){Basemap[]}

This function is used by the updateBasemapsCallback property for updating basemaps after being fetched and filtered.

Parameter:
items Basemap[]

An array of basemaps that have been fetched and filtered from the Portal.

Returns:
Type Description
Basemap[] The array of basemaps to display in the BasemapGallery widget.
Example:
let basemapGallery = new BasemapGallery({
   view: view,
   source: {
     query: {
       title: "United States Basemaps",
       owner: "Esri_cy_US"
     },
     updateBasemapsCallback: function(items) {
       // create custom basemap to be added to the array of portal basemaps
       let bm = new Basemap({
         portalItem: {
           id: "8dda0e7b5e2d4fafa80132d59122268c"  // WGS84 Streets Vector webmap
         }
       });
       // add basemap to the array
       items.push(bm);
       // return the array of basemaps
       return items;
     }
   }
});

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