[Qgis-developer] Pyqgis - join a CSV to a vector layer

kimaidou kimaidou at gmail.com
Thu Jun 19 01:07:19 PDT 2014


Martin,

Thanks for your answer. Indeed I did not add the layer to the registry in
my foreach loop. I did it at the end (for better performance )
Now it is working, thanks a lot !

Michael


2014-06-19 6:54 GMT+02:00 Martin Dobias <wonder.sk at gmail.com>:

> Hi Michael
>
> your code works for me. Maybe you have not added the loaded DBF to the
> QgsMapLayerRegistry before using it for the join? The main layer
> otherwise does not have a way to resolve the reference to layer from
> its ID.
>
> By the way, it is not necessary to set "joinFieldIndex" and
> "targetFieldIndex" members - they will have no effect.
>
> Regards
> Martin
>
>
> On Thu, Jun 19, 2014 at 12:22 AM, kimaidou <kimaidou at gmail.com> wrote:
> > Hi all.
> >
> > I am trying to join a DBF to a vector layer via python . I can create the
> > QgsVectorJoinInfo() , set the parameters and add it to the layer :
> > https://pastee.org/fv55y
> >
> > When I get vlayer.vectorJoins() , it is filled (3 times, because I made 3
> > attempts), but when I open the vector layer properties dialog, no join
> > appears in the Join tab.
> >
> > Should I update something after adding the join via addJoin method ? Has
> > anyone a working example ?
> >
> > Thanks in advance
> >
> > Michael
> >
> > _______________________________________________
> > Qgis-developer mailing list
> > Qgis-developer at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20140619/26fb7cb3/attachment.html>


More information about the Qgis-developer mailing list