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.


This will return you the extent of the canvas.

extent = iface.mapCanvas().extent()

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

| improve this answer | |
  • Someone should make a plugin for this. I would but I don't know how to do that. – boulder_ruby Mar 26 '15 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 '15 at 3:06
  • For some people, what you just said is TMI. QGis should squish ArcGIS like a bug as much as it can. Shame on them for not opening up to Unix platforms. – boulder_ruby Sep 30 '15 at 1:27
  • 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 '15 at 3:27
  • I'm not complaining! Its not like I was asking you to create a plugin for me. Thank you! – boulder_ruby Jan 27 '16 at 0:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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