ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / MapFactory Class / CreateMap Method / CreateMap(String,MapType,MapViewingMode,Basemap) Method
The name of the map
ArcGIS.Core.CIM.MapType (Optional) The type of the map. (default value = MapType.Map)
ArcGIS.Core.CIM.MapViewingMode (Optional) Map's default viewing mode. (default value = MapViewingMode.Map)
Basemap (Optional) Map's basemap which can be the one that is set as the default for the project or one of the ArcGIS Online basemaps. If you want create a map without basemap, set it to Basemap.None. (default value = Basemap.ProjectDefault)
Example

In This Topic
    CreateMap(String,MapType,MapViewingMode,Basemap) Method
    In This Topic
    Creates a new Map in the project. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Overloads Function CreateMap( _
       ByVal name As String, _
       Optional ByVal mapType As MapType, _
       Optional ByVal defaultViewingMode As MapViewingMode, _
       Optional ByVal basemap As Basemap _
    ) As Map

    Parameters

    name
    The name of the map
    mapType
    ArcGIS.Core.CIM.MapType (Optional) The type of the map. (default value = MapType.Map)
    defaultViewingMode
    ArcGIS.Core.CIM.MapViewingMode (Optional) Map's default viewing mode. (default value = MapViewingMode.Map)
    basemap
    Basemap (Optional) Map's basemap which can be the one that is set as the default for the project or one of the ArcGIS Online basemaps. If you want create a map without basemap, set it to Basemap.None. (default value = Basemap.ProjectDefault)

    Return Value

    A map.
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Link Charts must be created with MapFactory.CreateLinkChart.
    Remarks
    To open a map, use ProApp.Panes.CreateMapPaneAsync method.
    Example
    How to add a new map to a project
    {
      // Note: Needs QueuedTask to run
      //Note: see also MapFactory in ArcGIS.Desktop.Mapping
      var map = MapFactory.Instance.CreateMap("New Map", MapType.Map, MapViewingMode.Map, Basemap.Oceans);
      ArcGIS.Desktop.Framework.FrameworkApplication.Panes.CreateMapPaneAsync(map);
    }
    Create a new map with a default basemap layer
    {
        //Note: Needs QueuedTask to run
        MapFactory.Instance.CreateMap("The Map", ArcGIS.Core.CIM.MapType.Map, ArcGIS.Core.CIM.MapViewingMode.Map, Basemap.ProjectDefault);
    }
    Open a diagram pane from a Network Diagram
    {
      // Create a diagram layer from a NetworkDiagram
      static void CreateDiagramLayerFromNetworkDiagram(NetworkDiagram networkDiagram)
      {
        // Create the diagram map
        Map newMap = MapFactory.Instance.CreateMap(networkDiagram.Name, MapType.NetworkDiagram, MapViewingMode.Map);
    
        // Open the diagram map
        Task<IMapPane> mapPane = ProApp.Panes.CreateMapPaneAsync(newMap, MapViewingMode.Map);
    
        //Add the diagram to the map
        DiagramLayer diagramLayer = newMap.AddDiagramLayer(networkDiagram);
      }
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also