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 coordinatesDevelopment 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 |