0

This question already has an answer here:

Does anyone know how I can get the coordinate value displayed at the buttom of the qgis window? I have been searching through the qgis api but am not able to find anything suitable..

marked as duplicate by Ian Turton Mar 7 at 17:50

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    seems to me this question has been asked 1000 times ... "clicked coordinates qgis python" in google led me to several answers of gis.stack exchange ... – snaileater Mar 7 at 16:44
0

this code is a simple example for access to cursor coordinates:

def canvasMoveEvent(event):
    x = event.pos().x()
    y = event.pos().y()
    point = canvas.getCoordinateTransform().toMapCoordinates(x, y)
    print ('({:.4f}, {:.4f})'.format(point[0], point[1]))

from qgis.gui import QgsMapToolEmitPoint

canvas = iface.mapCanvas() 
pointTool = QgsMapToolEmitPoint(canvas)

pointTool.canvasMoveEvent = canvasMoveEvent

canvas.setMapTool( pointTool )

I hope it helps you

Not the answer you're looking for? Browse other questions tagged or ask your own question.