Im trying to get the layer coordinates with a mouse click in ArcMAP. I did this in QGIS and im not finding anything on how to get this working in ArcMAP. Here is the QGIS version:
def selectPoint(self):
self.pointEmitter = QgsMapToolEmitPoint(self.iface.mapCanvas())
QObject.connect(self.pointEmitter, SIGNAL("canvasClicked(const QgsPoint, Qt::MouseButton)"), self.selectNow)
self.iface.mapCanvas().setMapTool(self.pointEmitter)
I got this working by creating a new plugin in plugin wizard and Choosing a "Tool" in the Toolbar.
-
1You're using QGIS code, it's not going to work in ArcMap. Have a read of the Esri post support.esri.com/en/technical-article/000011690 which explains how to do this in an arcpy addin.Michael Stimson– Michael Stimson2017年11月26日 23:43:00 +00:00Commented Nov 26, 2017 at 23:43
1 Answer 1
If you are trying to do this from ArcPy then you could look at using:
Feature sets allow features to be entered interactively and immediately used as input to a model or script.
Python Add-ins give users the ability to create Python written tools that respond to a mouse click.
-
i cant find "onMouseDownMap" on the add.in wizard. Is there a way to call that function in a existing add-in?José Gabriel– José Gabriel2017年11月27日 09:18:38 +00:00Commented Nov 27, 2017 at 9:18
-
@JoséGabriel the AddIn Wizard writes code that includes it.2017年11月27日 10:01:20 +00:00Commented Nov 27, 2017 at 10:01