Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I have a print composer called "ABC", I would like to "tell" its composer that I would like to

  1. update "Map 0" to simulate the "set to map canvas extent" button activation
  2. update certain text labels
  3. activate "export to image"

Thank you.

share|improve this question
up vote 2 down vote accepted

On the topic of print output from pyQGIS: (Note: master has QgsComposition::loadFromTemplate method, which 1.8 has not).

Basically, in 1.8, you have to create the composition (with map, labels, etc.) from scratch in code anyway. So no updates are needed.

share|improve this answer
Thank you @underdark – n1kn0k Mar 12 '13 at 12:31

Just an update for this question given the QGIS 2 API is a bit better for these things.

Re your 1, if you want to update the maps in a composer, use code such as:

map_item = composition.getComposerItemById('map')

Re your 2, use:


Re your 3:- as Underdark suggested, there is example code to export to both images and PDF at the QGIS Python API cookbook:-


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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