The basemaps controller allows you to manage the map's basemap layer.
You can get the current basemap, list available basemaps, change the basemap, and be notified when the basemap changes.
getCurrentBasemap()
getCurrentBasemap (): Promise<Basemap >
Gets the currently active basemap.
Use this method to retrieve information about the current basemap, including its type (Felt, color, or custom tile), name, color scheme, and attribution.
Promise<Basemap >
A promise that resolves to the current basemap configuration.
getBasemaps (): Promise<Basemap []>
Gets all basemaps available on the map.
Use this method to retrieve a list of all available basemaps that can be applied to the map.
Promise<Basemap []>
A promise that resolves to all basemaps available on the map.
chooseBasemap()
chooseBasemap (id: string): void
Chooses the basemap to use for the map.
Use this method to change the current basemap. The basemap ID can be obtained from getBasemaps().
void
A promise that resolves when the basemap has been set.
addCustomBasemap()
addCustomBasemap (args: { basemap: ColorBasemapInput | CustomTileBasemapInput ; select: boolean; }): Promise<Basemap >
Adds a custom basemap to the map. This can be either a solid color or a basemap from a custom tile URL.
Whether to select the basemap after adding it.
Promise<Basemap >
A promise for the added basemap.
removeBasemap()
removeBasemap (id: string): Promise<void>
Removes a basemap from the list of available basemaps.
Promise<void>
A promise that resolves when the basemap has been removed.
onBasemapChange()
onBasemapChange (args: { handler: (basemap: Basemap ) => void; }): VoidFunction
Adds a listener for when the basemap changes.
Use this to react to basemap changes, such as updating your UI or adjusting other map elements to match the new basemap's color scheme.
{ handler: (basemap: Basemap ) => void; }
VoidFunction
A function to unsubscribe from the listener.
Last updated 3 months ago