I've asked a similar question here: How to quickly calculate bounding box coordinates of a selected polygon with qgis

...regarding a quick way to determine the bounding box of a given layer.

Is there any way to do the same thing for the current qgis view? I imagine it is an iface property but cannot find it in the documentation. Thanks.

update: I'm working with the qgis print (map) creator right now, and I've found a button which appears to call a function that I'm alluding to. If you open the print creator, in the right side bar there is a menu button called "Item Properties". Click on this and below there is a submenu called "Extents". Expand that and there is a button called "Set to map canvas extent". This button appears to utilize the function I'm alluding to by extracting the bbox coords of the main qgis map view.

1 Answer 1


This will return you the extent of the canvas.

extent = iface.mapCanvas().extent()

Reference: http://qgis.org/api/classQgsMapCanvas.html#a878f0c387c9475d59c6aac425db01020

  • Someone should make a plugin for this. I would but I don't know how to do that. Mar 26, 2015 at 3:00
  • To do what? If you need to see it in the UI you can get that info from the status bar.
    – Nathan W
    Mar 26, 2015 at 3:06
  • 1
    You asked how to get the info and I told you. This is how you get it using Python the UI method is in status bar.
    – Nathan W
    Sep 30, 2015 at 3:27
  • I'm not complaining! Its not like I was asking you to create a plugin for me. Thank you! Jan 27, 2016 at 0:49
  • Perhaps suggest a method to print the co-ordinates: print iface.mapCanvas().extent().asWktCoordinates();
    – Rob
    Nov 16, 2016 at 5:02

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.