[Qgis-developer] Scripting QGIS from the outside using Python

Nathan Woodrow madmanwoo at gmail.com
Sun Mar 18 20:22:34 EDT 2012


It's not so much that I don't know how to create a new composer from Python
more that I don't now how to restore a composer item from the project file
using Python.

I'm using the project file that contains composers as a template which I
need to open and print.  What I have seen so far looks like you have to
handle recreating the composer and all its items using the xml like in

the composer object could do with a createFromXML() method which constructs
a composer, and all its children, as per the project file.

- Nathan

On Mon, Mar 19, 2012 at 4:51 AM, Martin Dobias <wonder.sk at gmail.com> wrote:

> On Thu, Mar 15, 2012 at 2:29 PM, Nathan Woodrow <madmanwoo at gmail.com>
> wrote:
> > Is it possible to:
> >
> > Load QGIS from Python (well I know how to do this using
> > QgsApplicaiton.Init())
> > Open the project file
> > Zoom to a location
> > Print the first composer to pdf
> > OR render out the map canvas to a image.
> Hi Nathan
> yes that's all possible from an external python script with PyQGIS,
> without actually starting GUI.
> > From what I can see the only way is to create a new composer item and
> pass
> > it the composer node from the xml.
> No need to play with XML, everything can be done using API, there is
> an example in the cookbook:
> http://qgis.org/pyqgis-cookbook/composer.html
> Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20120319/a6c284bf/attachment.html

More information about the Qgis-developer mailing list