14

In QGIS I am working on a map with lines connecting locations created with the MMQGIS plugin. Is there an easy way to make those direct lines somewhat curvy for aesthetic purposes?

I'm trying to achieve something like the map below but with several hubs. I have read suggestions on how to do this with PostGIS and other advanced tools, so I've done my research (including other posts here) and tried using several plugins, and I'm specifically asking for an easy solution because I don't have much experience.

Example

4
  • is there a way to undo the curve while editing or undo a point where you accidentally placed it?
    – 3mm
    Jan 24, 2019 at 17:33
  • Welcome to GIS SE! As a new user, please be sure to take the short tour to learn about this site's focused Q&A format. If you have a question, please use the Ask Question link rather than posting an answer.
    – Andy
    Jan 24, 2019 at 17:56
  • If you have a new question, please ask it by clicking the Ask Question button. Include a link to this question if it helps provide context. - From Review
    – csk
    Jan 24, 2019 at 18:43
  • Please, do not forget about "What should I do when someone answers my question?"
    – Taras
    Jun 20, 2022 at 5:52

3 Answers 3

17

Use Arrows style instead of Simple Line style.

For example, these lines with Simple Line style:

enter image description here

look like this with Arrow style:

enter image description here

You can turn off the arrow heads by setting the head width and length to 0.

As you can see, the straight line becomes a straight arrow, while the lines with a middle vertex become curved arrows. The placement of the middle vertex determines the curve of the arrow.

To convert your straight lines to curved arrows, you'll need to add a middle vertex to every line, and then offset that vertex enough to generate a curved arrow.

Use the Geometry Generator style with Geometry type: Linestring. This expression will create a line with a midpoint 200 distance units to the east and north of the original midpoint of the line.

  make_line( start_point( $geometry), translate( centroid( $geometry), 200,200), end_point($geometry))

Change the line to display as an Arrow style. Adjust the centroid offset values in the geometry generator expression until you're happy with the shape of the arrows. If you want, you can make them proportional to the length of the original line, eg $length/10. The full expression would be:

make_line( start_point( $geometry), translate( centroid( $geometry), $length/10, $length/10), end_point($geometry))

Here's what it looks like, with the original lines in pink and the geometry-generated arrows in black:

enter image description here

If you aren't satisfied with the line midpoint placement, you can adjust them manually. First, convert the geometry generated line style into an actual layer. Copy the expression from the geometry generator into the geometry by expression tool (Processing toolbox). Then use the Vertex Tool (Digitizing toolbar) to manually move the vertices.

Note: This answer was made with QGIS 3.4.

1
  • I think only translating the Y direction would give the effect of being straight when the lines are oriented north and south,like his original picture.
    – Baswein
    Jul 15, 2020 at 2:17
7

If you are using QGIS 2.12 or later, you would have "Add circular string" Tool in "Digitizing Toolbar". Or you may want to try "Spline plugin".

(LHS) Add circular string tool during digitize, (RHS) Spline tool during digitize

digitizing

You can see Add circular string tool (LHS) draws a circular or semi-circular line, while Spline tool (RHS) interpolates points to fit your line to spline curve. Whichever you choose, you just need to click 3 points: start point, curve point and end point.

And you will get:

outcome

There are other tools such as CadTools but it will be more exciting if you find it yourself.

2
  • 1
    Thanks. I'm not looking to create lines, but to curve (not manually) the ones I already created with mmqgis. Also not looking for excitement, just for something to get the job done. It's why I came here, so any help would be appreciated! :)
    – darj
    Oct 26, 2016 at 16:18
  • 1
    Got that, thanks. And sorry I was mistaken. Now I understand you already have Hub Lines created by MMQGIS plugin.
    – Kazuhito
    Oct 26, 2016 at 18:12
5

You have to make a few more steps: (I have the Dutch version so if it's not the right translation, sorry). Like @bugmenot did, but then again choose Fill and and change it from Symbol Layer Type Standard Filling to : 'Rand/Edge?:Arrow . I'v done a coloureffect gradual filling[geleiddelijke vulling] in the last 'Fill'. Hope it helpd. enter image description here

2
  • Thanks! Is it possible to adjust the angle of the curve so it's more flat like in the image I posted?
    – darj
    Oct 27, 2016 at 18:39
  • I dont think thats possible. Perhaps with some scripting in Python, but thats not my cup of thea.
    – Willem
    Oct 30, 2016 at 21:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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