How to get map coordinates from screen coordinates


Summary
This article summarizes how to obtain the real-world (map) coordinates from the device (screen) coordinates.

Getting map coordinates from screen coordinates

Call GetMapCoordinatesFromScreenCoordinates by passing in an IPoint that contains the x,y values from the device (screen) in your Windows application and an IActiveView. An IPoint containing the real-world (map) coordinates is returned.
See the following:
[Java]
static IPoint getMapCoordinatesFromScreenCoordinates(IPoint screenPoint, IActiveView
    activeView)throws Exception{

    if (screenPoint == null || screenPoint.isEmpty() || activeView == null)
        return null;


    IScreenDisplay screenDisplay = activeView.getScreenDisplay();
    IDisplayTransformation displayTransformation =
        screenDisplay.getDisplayTransformation();

    return displayTransformation.toMapPoint((int)screenPoint.getX(), (int)
        screenPoint.getY());
}


See Also:

Convert map coordinates to screen coordinates




Development licensing Deployment licensing
ArcGIS for Desktop Basic ArcGIS for Desktop Basic
ArcGIS for Desktop Standard ArcGIS for Desktop Standard
ArcGIS for Desktop Advanced ArcGIS for Desktop Advanced
Engine Developer Kit Engine