ArcGIS Explorer Component Help |
Application..::.GetBasemaps Method |
Application Class Example See Also |
Assembly: ESRI.ArcGISExplorer.Application (in ESRI.ArcGISExplorer.Application.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public static ReadOnlyCollection<Basemap> GetBasemaps() |
Visual Basic (Declaration) |
---|
Public Shared Function GetBasemaps As ReadOnlyCollection(Of Basemap) |
Return Value
A read-only collection of Basemaps.Remarks
ArcGIS Explorer comes preconfigured with basemaps for ArcGIS Online and Bing map services. You can use this method to return a collection of all the preconfigured basemaps available to the user. This includes the default basemaps and also any user-specific basemaps saved by the user on the current machine. The set of default basemaps available to the application is defined by ArcGIS Online, and therefore may change between releases.
This method also honors any basemap settings from application configurations; if ArcGIS Explorer is running with an application configuration, the collection will return only the configured basemaps. For example, if the configuration specifies that default basemaps should not be available, then only the user-specific basemaps will be returned in this collection. Similarly, if the configuration specified a collection of new basemaps to be available, these will be returned in this collection.
Version Information: This property is supported from version 2.0.0.1500.
Examples
// Create custom basemap using an existing map file. Basemap customBasemap = new Basemap(@"C:\Basemaps\RedlandsBasemap.nmf"); //Set the basemap name customBasemap.Name = "Redlands"; // Create custom basemap with a map file and specified name. Basemap basemapWithName = new Basemap(@"C:\Basemaps\RedlandsBasemap.nmf", "Redlands"); // Retrieve the current Basemaps collection. System.Collections.ObjectModel.ReadOnlyCollection<Basemap> currentBasemaps = ESRI.ArcGISExplorer.Application.Application.GetBasemaps(); // Try finding Bing Hybrid basemap using the LINQ Contains method. // You will need an imports statement to the System.Linq namespace. var subset = from n in currentBasemaps where n.Name.Contains("Bing Maps Hybrid") select n; if ((subset != null) && (subset.Count() > 0)) { // Apply a basemap to the current map. ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.Map.Basemap = subset.First(); }
'Create custom basemap using an existing map file Dim customBasemap As New Basemap("C:\Basemaps\RedlandsBasemap.nmf") 'Set the basemap name customBasemap.Name = "Redlands" 'Create custom basemap with a map file and specified name Dim basemapWithName As New Basemap("C:\Basemaps\RedlandsBasemap.nmf", "Redlands") ' Retrieve the current Basemaps collection. Dim currentBasemaps As System.Collections.ObjectModel.ReadOnlyCollection(Of Basemap) = ESRI.ArcGISExplorer.Application.Application.GetBasemaps() ' Try finding Bing Hybrid basemap using the LINQ Contains method. ' You will need an imports statement to the System.Linq namespace. Dim subset = From n In currentBasemaps Where n.Name.Contains("Bing Maps Hybrid") Select n If ((Not subset Is Nothing) AndAlso (subset.Count() > 0)) Then ' Apply a basemap to the current map. ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.Map.Basemap = subset.First() End If