How to get screen coordinates from map coordinates


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

Getting screen coordinates from map coordinates

Call GetScreenCoordinatesFromMapCoordinates by passing in an IPoint that contains the real world (map) coordinates. An IPoint that contains the x,y device (screen) coordinates for your Windows application is returned.
See the following:
[Java]
public IPoint getScreenCoordinatesFromMapCoorindates(IPoint mapPoint, IActiveView
    activeView)throws Exception{
    if (mapPoint == null || mapPoint.isEmpty() || activeView == null)
        return null;


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

    int x[] = new int[1];
    int y[] = new int[1];
    displayTransformation.fromMapPoint(mapPoint, x, y);
    IPoint returnPoint = new Point();
    returnPoint.putCoords(x[0], y[0]);
    return returnPoint;
}


See Also:

Convert screen coordinates to map 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