I have a shapefile containing a lot of lines which I'm trying to separate based on direction.

Is there any way to calculate the line bearing against a compass (in degrees or just as North / North-East / East etc.) add this calculated value as a column to the shapefile?


1 Answer 1


Here's something simple that worked for me.

  1. Extract vertices from your line layer.
  2. Install Shape Tools Plugin. Use Create Shape function and create a "line of bearing". For the Azimuth Field input select ANGLE. For the distance field, nothing. Then specify a standard length for all the lines.
  3. Run it and you'll get a new line layer with the extended lines. If you need the lines to go the other way, reverse the azimuth values.

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