[Qgis-developer] Is it possible to re-use print composer code to build a web service ?

Alessandro Pasotti apasotti at gmail.com
Mon Dec 20 10:54:55 EST 2010


2010/12/20 Martin Dobias <wonder.sk at gmail.com>

> On Mon, Dec 20, 2010 at 4:36 PM, Alessandro Pasotti <apasotti at gmail.com>
> wrote:
> >>
> >> It seems that the segfault happens in the python finalization code.
> >> Such crashes happen if the qt objects are deleted in wrong order.
> >> Presumably the QApplication object has been deleted earlier than the
> >> composition. That could be solved by various ways, for example,
> >> delete the composition at the end or set QApplication to be parent of
> >> the composition.
> >>
> >> Since the code crashes in the finalization stage, you should get the
> >> output png file anyway. Can you please check?
> >
> > Yes, the out.png is there but it contains a blank (white) image.
>
> Looking at the code, I see that you create an instance of
> QgsMapRenderer, but do not initialize. You should call its
> setLayerSet() and setExtent() methods so that it knows what to render.
>

Yes you're right, I did too much cut-n-paste, just added:

lst = [ vlayer.getLayerID() ]
mapRenderer.setLayerSet(lst)
rect = core.QgsRectangle(mapRenderer.fullExtent())
rect.scale(0.8)
mapRenderer.setExtent(rect)


and now the image shows the map correctly.... but it still segfaults.

Dou you think is it also possible (always from a standalone script) to load
a map composer template and a qgis project from their XML files?


-- 
Alessandro Pasotti
w3:   www.itopen.it
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20101220/8d9dc489/attachment.html


More information about the Qgis-developer mailing list