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

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

    Parameters

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

    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 (the map referenced by the map item is tested): 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" vs "local").
    The intended conversion can be tested by calling the CanConvertMapFromItem method first.
    Specifying openView=true will open a new view for the converted map (in the item). 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.
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also