[GIS] Selecting feature and getting its fields by mouse click using Python Addin in ArcGIS

arcpypython-addin

I'm building a python addin tool in arcgis and I would like to click a feature, say a polygon on the map, and get the polygon's attributes,i.e. ID=3,NAME = "CITY3"…It's similar as the arcmap tool Identify without a pop-up window.

I can only think of a way by getting the mouse click XY first, and do a select by location query to get the feature.I'm wondering is there a better way of doing this?

Or is it possible to grab the information from Identify tool using python addins?

Best Answer

No, that's the way to do it. Respond to a mouse click event and then select by location, get the values using arcpy.da.searchcursor.