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

Martin Dobias wonder.sk at gmail.com
Wed Jun 18 21:54:49 PDT 2014


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


More information about the Qgis-developer mailing list