I am wanting to join a csv with an shp file any ideas on the methods used to complete this.

I've seen a few different ways none of which are working for me?

  • Why do you want to use the python for something like that? – geoSAM Oct 18 '19 at 5:52
  • Could you edit your question to include the code snippets you tried please? This would help to re-open your question. – Joseph Oct 18 '19 at 10:03

One way would be to use a virtual layer with Python:

query = "?query=Select shapefile.*, csv.* from shapefile join csv on shapefile.commonfield = csv.commonfield;"
vlayer = QgsVectorLayer( query, , "joined layer", "virtual" )

shapefile is your shapelayer and csv your CSV-table

|improve this answer|||||

Not the answer you're looking for? Browse other questions tagged or ask your own question.