ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Desktop.Layouts Namespace / MapFrame Class / PageToMap Method / PageToMap(MapPoint) Method
The point in page coordinates
Example

In This Topic
    PageToMap(MapPoint) Method
    In This Topic
    Translates a point in page coordinates to a point in map coordinates. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public MapPoint PageToMap( 
       MapPoint pagePoint
    )
    Public Overloads Function PageToMap( _
       ByVal pagePoint As MapPoint _
    ) As MapPoint

    Parameters

    pagePoint
    The point in page coordinates

    Return Value

    A point in map coordinates
    Exceptions
    ExceptionDescription
    Mapframe must contain a 2D map
    pagePoint
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Remarks
    The map coordinates will be in the spatial reference of the map associated with the map frame. Page coordinates can only be translated for 2D maps. If the map frame does not contain a 2D map, an System.InvalidOperationException is thrown. If either page coordinate value is double.NaN then a point with X, Y both set to System.Double.NaN is returned.
    Example
    Translates a point in page coordinates to a point in map coordinates.
    //On the QueuedTask
    var layout = Project.Current.GetItems<LayoutProjectItem>().FirstOrDefault().GetLayout();
    var mapFrame = layout.FindElement("New Map Frame") as MapFrame;
    
    //Get a point in the center of the Map frame
    var mapFrameCenterPoint = mapFrame.GetBounds().CenterCoordinate;
    //Convert to MapPoint
    //At 2.x - var pointInMapFrame = MapPointBuilder.CreateMapPoint(mapFrameCenterPoint);
    var pointInMapFrame = MapPointBuilderEx.CreateMapPoint(mapFrameCenterPoint);
    
    //Find the corresponding point in the MapView
    var pointOnMap = mapFrame.PageToMap(pointInMapFrame);
    
    //Create a point graphic on the MapView.
    var cimGraphicElement = new CIMPointGraphic
    {
      Location = pointOnMap,
      Symbol = pointSymbol.MakeSymbolReference()
    };
    graphicsLayer.AddElement(cimGraphicElement);
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also