ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / MapFactory Class / ConvertMap Method
The map to convert
The type to convert the map to
true to open a map pane for the newly converted map
Example

In This Topic
    ConvertMap Method (MapFactory)
    In This Topic
    Convert the input map to the specified output type. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Function ConvertMap( _
       ByVal map As Map, _
       ByVal convertTo As MapConversionType, _
       ByVal openView As Boolean _
    ) As Map

    Parameters

    map
    The map to convert
    convertTo
    The type to convert the map to
    openView
    true to open a map pane for the newly converted map

    Return Value

    The converted Map
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Cannot convert {map} to {conversion type}
    Failed to convert the map viewing mode
    Remarks
    The following conversions are supported: o Map -> Base map, Scene (Global), Scene (Local)
    o BaseMap -> Map
    o Scene (Global) -> Map
    o Scene (Local) -> Map
    Technically, there is no difference between the Scene (Global) or Scene (Local). It merely indicates the nature or their underlying coordinate system (i.e. "global" or "local").
    The intended conversion can be tested by calling the CanConvertMap method first.
    Specifying openView=true will open a new view for the converted map. The method will return without waiting for the view to initialize and begin drawing. This is an optimization to prevent Pro being loaded down with viewer initialization if this method is called within a loop to create multiple maps. The correct way to detect viewer initialization is via the ArcGIS.Desktop.Mapping.Events.ActiveMapViewChangedEvent. The event will fire after the first draw of the new view has been initiated.
    Example
    Convert Map to Local Scene
    //Note: Run within the context of QueuedTask.Run
    bool canConvertMap = MapFactory.Instance.CanConvertMap(map, MapConversionType.SceneLocal);
    if (canConvertMap)
      MapFactory.Instance.ConvertMap(map, MapConversionType.SceneLocal, true);
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also