I would like to know if it is possible to get the coordinates from a user clicked point in the current map document - arcpy.mapping.MapDocument("CURRENT")?
I am using ArcGIS Desktop 10.0.
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.Sign up to join this community
There is an Esri How To: Capture map coordinates with a mouse click using Python with code. This also mentions that:
"Prior to ArcGIS 10.1, Python could not be used to interact with the ArcGIS interface."
I have tried that code but I have not been able to get the button I have the code behind to activate so I cannot yet confirm that the code works. I am using ArcGIS Desktop 10.1 SP1.
My code for your reference is:
import arcpy import pythonaddins class ClickForXYCoordinates(object): """Implementation for MyPythonAddIn_addin.button (Button)""" def __init__(self): self.enabled = True self.shape = "NONE" def onMouseDownMap(self, x, y, button, shift): message = "Your mouse clicked:" + str(x) + ", " + str(y) pythonaddins.MessageBox(message, "My Coordinates")