5

I’m used to using QGIS for simple operations, but I’ve not found a solution for this.

I have a few vector point layers containing several hundred points in total. The points relate to a raster layer (I can’t post the raster publicly here).

For each vector point, I need to gather data on the raster values from around it, grouped by direction (in 22.5 degree wedges) and distance from the vector point (in 10 regularly-spaced bands). My standard method to gather data around vector points from rasters is to create vector polygons around the point using the Rectangles Oval Diamonds or a buffer tool, and then use Raster Statistics for Polygons or Zonal Statistics to gather the relevant data within the polygon area from the raster.

My issue is trying to create a polygon layer around each point which incorporates both the ring and wedge form, like this one:

enter image description here

I’ve tried the various buffer and shape creation tools that I’m aware of, but none create a polygon layer of this complexity (there are, in practice, 160 polygons in this layer). I can generate the rings using various tools and plugins, but I haven’t found I way to create multiple wedges or to combine the two into one overlay layer.

I can draw each polygon manually by using ring and wedge tools or by splitting the rings with polygon editing tools, as I have for this example, but because I need to repeat this operation for several hundred vector points, I need to find a way to automate it more.

I’ve found questions relating to various types of buffers on here, but not a solution for one of this form (apologies if I’ve overlooked something). Any suggestions on how to approach this?

1 Answer 1

5

You can create such repeated wedge-buffers using QGIS expressions with Geoemtry generator or Geometry by expression. The trick is to use wedge_buffer() function together with array_foreach() twice to iterate 1) for each band (increasing distance) and 2) for each angle-segment (increasing angle).

Use this expression on your point-layer (see at the bottom for some details to be aware of). Change 100 (three times on lines 14 and 15) for the distance of the regularly spaced bands and on line 9, chang (0,9) for the number of rings you want to get, here:10 (0 to 9):

collect_geometries (
    array_foreach (
        generate_series (0,15),
        with_variable (
            'azim',
            @element,
            collect_geometries (
                array_foreach (
                    generate_series (0,9),
                    wedge_buffer( 
                        $geometry, 
                        @azim*22.5+(22.5/2), 
                        22.5,
                        @element*100,
                        100+@element*100
                    )
                )
            )
        )
    )
)

The expression in action, here with Geoemtry generator and transparent color to show that there are no overlapping polygons: enter image description here

Things to be aware of:

  • Using Geometry by expression, output will be one multipart geometry. Use Multipart to singleparts to get individual features.

  • When working with angles, be sure to use an appropriate CRS: one that preserves angles like Mercator projection.

  • Also be aware of distance distortion of the CRS you select if your area of interest does cover larger areas.

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.