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

2014-06-19 Thread kimaidou
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 :

> 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  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@lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

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

2014-06-18 Thread Martin Dobias
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  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@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


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

2014-06-18 Thread kimaidou
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@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer