public static Task<IReadOnlyList<PortalItem>> GetBasemapsAsync( ArcGISPortal portal )
Public Shared Function GetBasemapsAsync( _ ByVal portal As ArcGISPortal _ ) As Task(Of IReadOnlyList(Of PortalItem))
Parameters
- portal
public static Task<IReadOnlyList<PortalItem>> GetBasemapsAsync( ArcGISPortal portal )
Public Shared Function GetBasemapsAsync( _ ByVal portal As ArcGISPortal _ ) As Task(Of IReadOnlyList(Of PortalItem))
Exception | Description |
---|---|
PortalConnectionDoesNotExistsException | Thrown when an invalid portal is provided as the active portal. |
System.InvalidOperationException | Base map gallery group query was not found. |
System.InvalidOperationException | Base map gallery group for 'baseMapGroupQuery' was not found. |
System.Net.Http.HttpRequestException | You do not have permissions to access this resource or perform this operation. |
System.Net.Http.HttpRequestException | Request failed: status code {status code}. |
//Basemaps stored locally in the project. This is usually an empty collection string localBasemapTypeID = "cim_map_basemap"; var localBasemaps = await QueuedTask.Run(() => { var mapContainer = Project.Current.GetProjectItemContainer("Map"); return mapContainer.GetItems().Where(i => i.TypeID == localBasemapTypeID).ToList(); }); //portal basemaps. If there is no current active portal, the usual default //is arcgis online var portal = ArcGISPortalManager.Current.GetActivePortal(); var portalBaseMaps = await portal.GetBasemapsAsync(); //use one of them...local or portal... //var map = MapView.Active.Map; //QueuedTask.Run(() => map?.SetBasemapLayers(portalBaseMaps[0]));
Target Platforms: Windows 11, Windows 10