[Qgis-developer] qgsAtlasComposition

Hugo Mercier hugo.mercier at oslandia.com
Thu Apr 11 01:16:21 PDT 2013


Hi James,

Le 11/04/2013 08:37, Stott James a écrit :
> Hi all,
> 
> I am trying to use the atlas functionality in a standalone python script. I am using the qgsAtlasComposition class. I get an error running this line:
> 
> myAtlas.beginRender()
> 
> I get an unknown exception.

Can you share the code you're using ? Or a stack trace or a line number
where the error occurs ?
What version / git revision are you using ?

You have to call setCoverageLayer and setComposerMap before calling
beginRender(), is it the case ?

> 
> I have also found that running myAtlas.numFeatures() always returns 0 even though I have added a layer that has data using setCoverageLayer().

This is linked to the previous issue. Features are iterated over during
beginRender()

> 
> I did take a look at this page and followed the steps in the test:
> 
> https://github.com/qgis/Quantum-GIS/blob/master/tests/src/python/test_qgsatlascomposition.py
> 
> but I cannot get it to work in my script. I cannot get the test to work either. It always errors on the beginRender() line.

I was about to say everything work fine here, but ... I realized there
is something wrong with the last changes I did.

Should be fixed with this:
https://github.com/qgis/Quantum-GIS/pull/516

Not sure if it will fix your problem ...


-- 
Hugo Mercier
Oslandia


More information about the Qgis-developer mailing list