Initializes a new instance of the Basemap class from a specified map file (.nmf).
Namespace:
ESRI.ArcGISExplorer.MappingAssembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
Parameters
- path
- Type: System..::.String
The path to a map file (.nmf) containing one or more Basemap layers.
Remarks
This constructor will not set the Basemap name on initialization; the name will therefore be initialized as a blank string. The Basemap name appears in the ArcGIS Explorer contents window if the Basemap is applied to a map. You can change the Basemap name after construction by setting Basemap.Name property.
Examples
The code below demonstrates alternative ways to initialize a Basemap variable, using the overloaded constructors and the
GetBasemaps method on the Application class. Finally, the code illustrates how to switch the Basemap of the map by
setting it to the Bing Maps Hybrid basemap.
CopyC#
// 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(); }
CopyVB.NET
'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