1

I am currently trying to grab the map extent of each page in my QGIS atlas. My python function uses the line:

 iface.mapCanvas().extent().toString()

which prints the extent just fine. The only problem is the numbers don't match the extent shown in the item properties under 'Extents'. When I draw the polygon from these coordinates the area it covers is huge. The labelled extent does not even update when I switch pages. I have already tried several code snipppets among that the one from: Getting extent of composer map in PyQGIS? which does not work with my QGIS 2.99 nor does it actually solve my problem.

enter image description here

Do I need to specify in my function that it should only grab the extent of the @currentfeature or is there something else wrong ?

  • @iant The code provided in the link does not work with QGIS 2.99, which is the version I am working with. I tried it in 2.18 and it shows me the scale(not the extent). I adapted the code to provide the extent but again it does not refresh for each atlas page. – Carlos Sep 5 '17 at 12:57
  • please edit the question to reflect this new information then – Ian Turton Sep 5 '17 at 12:58

Your Answer

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

Browse other questions tagged or ask your own question.