0

I have transport flow represented by arrows within QGIS in one layer. The database is coded with cities ID for the origin and cities ID for the destination of the flow.

Flow

I also have in another layer, transporte lines with id of cities crossed by this line (using this answer to Creating list of intersected polygons for each line using QGIS?)

Line description

I would like to get the sum of flow between cities crossed by my transport lines

Line 1 : sum of 'flow' case when 'ORIGIN' is like 'CITIES_INTERSECTED' AND when 'DESTINATION' is like 'CITIES_INTERSECTED'

Line 2: sum of 'flow' case when 'ORIGIN' is like 'CITIES_INTERSECTED' AND when 'DESTINATION' is like 'CITIES_INTERSECTED'

Something like this i suppose

0

What if you use attribute name "flow" in the SELECT query you used according to https://gis.stackexchange.com/a/309359/20802 ?

Or you can write a PyQGIS script (a nested for loop), and iterate through the ids of the lines and sum the flow values.

  • I am totally fine with the usage of another virtual layer and the query. But I find it difficult to get how to refer to a field already calculated but a virtual layer? My cities intersected field is in a cirtual layer indeed – Arthur Jan 21 at 16:24

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.