1

Is there a way to access the map coordinates show in qgis status bar? I found only this,

iface.mainWindow().statusBar().currentMessage()

But I know it's not the way.

Or is there any way to capture the coordinates when cursor moves on map?

1 Answer 1

2

You can get what you see down there using these methods:

iface.mapCanvas().extent().center()
iface.mapCanvas().extent().toString()
5
  • Thank you very much. I want to automatically change a QTextBrowser with that value when cursor moves on map. Is there any way I can do it? any signal to emit when cursor moves?
    – Dil
    Commented Jun 11, 2014 at 10:43
  • qgis.org/api/…
    – Nathan W
    Commented Jun 11, 2014 at 10:46
  • Can you please help me to write that line.I'm very new to this field. I wrote one for mouse click event and it works. 'QObject.connect(self.clickTool, SIGNAL("canvasClicked(const QgsPoint &, Qt::MouseButton)"), self.handleMouseDown)' Can you please help me to write same like this for cursor movements.
    – Dil
    Commented Jun 11, 2014 at 11:10
  • @Dil please accept this answer if it solves the problem stated in your question. If you have a new question afterwards, please open a new thread.
    – underdark
    Commented Jun 11, 2014 at 17:37
  • OK underdark. I will ask a separate question. Thank You
    – Dil
    Commented Jun 12, 2014 at 13:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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