I need to show in QGIS the a flow map of commuters in a municipality of Italy, Bari. In a CSV file I know the place they come from (a field called ORIG) and the place where they go (the field DEST) and the total number of them QGIS (TOTALE). In a shapefile I have the points with the coordinates; in this file the reference field is called SEZ. Since I'm a bit ignorant in Python and SQL, could you please tell me a simple way to write few lines that would let me show in the map with lines where they come from and where they go? I would also crate lines with different width depending on the total number of commuters (the field called TOTALE). I tried to create a virtual layer selecting, from the CSV, the fields I would like to show, then joining the CSV with the shapefile. But it didn't work. I think I'm not writing the code in the correct way. I saw there is a plug-in as well, Map Flow, but I need to create a matrix that is too long to write down.
I had to do something similar once and I used RT QSpider plugin.
Install the plugin RT QSpider in Plugins > Manage and Install plugins
Add the coordinates inside the attribute table of your shapefile of locations (if it is not already the case). To do so, you can use the tool in Vector > Geometry Tools > Export/Add geometry columns. It will create two new fields in the attribute table called xcoord and ycoord
Open your csv file in QGIS using Layer > Add Layer > Add Delimited Text Layer
Now you'll have to create 2 joins on your csv (one for the origin, and one for the destination). Right click on your csv in the Layer panel > Properties > Joins. Create the first join with the shapefile with geometry columns, join field should be SEZ and target field ORIG. Tick choose which fields are joined and select only xcoord and ycoord. Tick also Custom field name prefix and write origin_.
Create a second join using the same method but this time for the destination (select the DEST field in target field and write dest_ as prefix).
If the joins worked, you should have in the attribute table of your csv 4 new fields (origin_xcoord, origin_ycoord, dest_xcoord and dest_ycoord).
Select the csv in the Layer panel, and open the RT QSpider plugin in Plugins > RT QSpider > Table to vector converter.
Choose Line as Output Geometry and select the right fields for the starting and end points (origin and destination X and Y). Click on OK and you'll have your lines. Don't forget to save the result as a proper shapefile.
Then, for the styling of the line, go to Symbology > Graduated. Select Method : Size and select the TOTALE field to vary the width of the line depending on the number of commuters.
Just realized that the plugin is not (yet?) available for QGIS 3.x ... this method will only work in QGIS 2.x