Skip to content

Instantly share code, notes, and snippets.

@kgjenkins
Last active June 9, 2022 10:13
Show Gist options
  • Save kgjenkins/82b25176e607eb5b2fd8b6bb9cb6613b to your computer and use it in GitHub Desktop.
Save kgjenkins/82b25176e607eb5b2fd8b6bb9cb6613b to your computer and use it in GitHub Desktop.
QGIS line fill based on polygon angle

image

Use the following expression for the rotation value:

90 - azimuth(
  point_n( $geometry, 1),
  point_n( $geometry, 2)
) / 3.1415927 * 180

This expression gets the angle of the line between the first two points of the polygon, then converts from clockwise radians to counterclockwise degrees that are used by the rotation option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment