On Sun, Oct 6, 2013 at 9:45 AM, Daniel <daniel...@gmail.com> wrote:

> def createIndex( provider ):
>     feat = QgsFeature()
>     index = QgsSpatialIndex()
>     fit = provider.getFeatures()
>     while fit.nextFeature( feat ):
>         index.insertFeature( feat )
>     return index
>

Try something like this for your createIndex which will work with any
collection of features:

def createIndex( features ):
    index = QgsSpatialIndex()
    map(index.insertFeature, features)
    return index

index = createIndex(provider.getFeatures())

and also because I hate seeing while nextFeature() used :)

- Nathan
_______________________________________________
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to