1

I have an external .csv file with "From" cell, "To" cell, X, Y coordinates for the "From" cell, X Y coordinates for "To" cell and flow rate for water going from "From" cell to "to" cell. I can import this file in QGIS using Layer -> add Layer -> Add delimited text layer.

Each cell discharges water to one of its eight neighboring cells. My grid size is 80 x 80.

I would like to display water movement direction with an arrow for each cell.

Is there a way to do this in QGIS?

I do not want to use QGIS to determine the flow direction for me.

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
  • Edit your question and add a sample of the csv file as text. You also need to add a code attempt or your question is probably going to get closed – BERA Nov 07 '22 at 18:35

1 Answers1

1

Assuming your "FROM" and "TO" fields are formatted like 'x, y', You can use a "Geometry Generator" symbol layer with the following expression:

make_line(                              -- make a line of the FROM and TO points
    make_point(                         -- make a point of the FROM x, y coordinates
        string_to_array("FROM")[0],     -- make an array of the FROM x, y coordinates and get the first element (x)
        string_to_array("FROM")[1]      -- make an array of the FROM x, y coordinates and get the second element (y)
    ),
    make_point(
        string_to_array("TO")[0],       -- make an array of the TO x, y coordinates and get the first element (x)
        string_to_array("TO")[1]        -- make an array of the TO x, y coordinates and get the second element (y)
    )
)

To create a Geometry Generator symbol layer:

enter image description here

You can then select the Arrow line type:

enter image description here

Maybe it's nice to alter the width of the arrow depending on the flow rate. In this case, use these buttons to configure the width of your arrows:

enter image description here

If the raw flow rate is not appropriate as a width, you can enter an expression as a function of your flow rate:

enter image description here

Result:

enter image description here


References:

Matt
  • 16,843
  • 3
  • 21
  • 52