2

I have a point pattern fill for a polygon layer, I am trying to orient the markers (small horizontal line markers "-") such that they follow the trend of a line feature. Is there a way to accomplish this using line_interpolate_angle?

In the photo below, I am trying to orient the markers within the interior tan-coloured layer to follow the trend of the nearest line segment of the blue line.

enter image description here

5
  • I would dispute that this is a duplicate. This question specifically asks about orientating with a line layer, the other is asking the same but for a polygon boundary.
    – Matt
    Commented Jun 11, 2023 at 8:24
  • OP specified in a comment that they wanted to Orient towards a line and the first part of the answer exactly answers this. If this answer for any reason does not produce the desired result, we should know that to improve the answer.
    – Babel
    Commented Jun 11, 2023 at 12:45
  • 1
    @Evan did you read the answer here: gis.stackexchange.com/a/460055/88814 If so, please tell us what didn't work for you as in my understanding, it answers what you ask here
    – Babel
    Commented Jun 11, 2023 at 12:48
  • @Babel, would it be an idea to move the part of your other answer pertaining to the line layer here? That would nicely separate the approaches dealing with different geometry types (and keep both questions on-topic)
    – Matt
    Commented Jun 11, 2023 at 19:35
  • @Matt - did as you adviced.
    – Babel
    Commented Jun 11, 2023 at 21:11

1 Answer 1

4

Instead of point pattern fill, create a point grid covering the polygon: the point pattern fill is just one single geometry per polygon, even though visually, there are many. So you can't set an individual rotation.

From the point grid, keep only points intersecting the polygon: Select by Location > disjoint > Polygon layer > delete. Then set the point grid layer's style to simple marker > line and use data driven override for the rotation with this expression to follow a line (to follow the polygon's boundary, see below):

line_interpolate_angle(
    overlay_nearest('line_layer',$geometry)[0],
    line_locate_point(
        overlay_nearest('line_layer',$geometry)[0],
        $geometry
    )
)

Orientation/rotation of the small lines follows the blue line: enter image description here

Your Answer

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

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