[Qgis-developer] vectordataprovider.rewind() problem?

Martin Dobias wonder.sk at gmail.com
Tue Nov 25 15:33:56 EST 2008

On Tue, Nov 25, 2008 at 9:14 PM, Carson Farmer <carson.farmer at gmail.com> wrote:
> [...]
>       vproviderB.rewind()
>       while vproviderB.nextFeature( inFeatA ):
>           geom = QgsGeometry( inFeatA.geometry() )
> [...]
> Essentially what all this does, is loop through layerA, and calculates
> differences and intersections with layerB, then loops through layerB, and
> calculates difference with layerA. Technically, I don't even think rewind()
> needs to be called here at all, but then again... it's not working that way
> either?

But actually have you called vproviderB.select() before calling
vproviderB.nextFeautre()? I don't see it in the code (neither for

rewind() itself only resets internal counter for iterations with
nextFeature() and without a preceding select() it has no use. In
select() you define what stuff do you want to get from the provider,
by calling rewind() in fact you say you want the same stuff again.

> But what I'm no longer getting, is the interaction through layerB... the
> first bit runs fine, but the second bit won't run... it used too? I'm not
> entirely sure what's going on (abviously) so I'm going to continue to look
> into this using smaller examples to pint point the problem... I was really
> just interested in hearing if others were getting similar problems...

In first bit you use featureAtId() which is independent from the
select/nextFeature/(rewind) combination.


More information about the Qgis-developer mailing list