I have a polygon shapefile of aggregated commuting journeys that has >10,000 features in it. Each feature has a unique ID. I have a csv file that contains thousands of rows. Each row represents one feature from the shapefile. Each polygon can be represented by numerous rows, where each row is the count of journeys from the original polygon to the destination polygon. I have attached a picture that may better explain what I'm trying to articulate.

I want to create points in both the origin and destination polygons (joined by lines) to represent individual journeys. Does anybody know how using QGIS/Python etc. I could accomplish this?enter image description here


You can create an origin destination matrix and plot it in qgis using a plugin flow mapper.

For creating a origin and destination matrix from your data i think you need to reverse the script on this page https://stackoverflow.com/questions/38870319/tableau-reshaping-a-row-with-origin-destination-into-two-separate-origin-and-des, it should look like table given below : Origin destination matrix The yellow row and column are the nodes for origin and destination.

Save this matrix in tab delimited format without headers as shown below and also you would need a list of nodes with corresponding lat long to plot it on map. In total you need the three files given below : Headless OD MatrixScenerio
You can give names of the points i have kept codes hereNames
The coordinates of the points in longitude(1st column) Latitude(2nd column) formatCoords

Go ahead and use flow mapper plugin in qgis to plot it all on your map the final output would look like this : An OD map Map is from a different dataset with lot more Origin and destination points.

I think i made everything clear here, if you need any more help feel free to ping me : sandeepgadhwal1@gmail.com, Urbantalks.in.

  • Any suggestions and improvements are invited. Please share your thoughts on this. Oct 17 '17 at 21:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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