6

For a statistical analysis, I need to calculate some landscape properties in several (rectangular) sample areas, which vary in size (extent ranging from 10 by 10 to 500 by 500). These sample areas are located (scattered) randomly across a larger study area. For this analysis, I want to create several vector layers, in which each layer contains all sample areas with equal extent (every sample area being a rectangular polygon). All starts with a point-vector layer, each point being the center of a (potential) sample area.

I think the easiest way to create those rectangular polygons is by creating a (rectangular) buffer around every point. Pretty straightforward and lean.

But I would like to do this "in batch" since I want to create 50 layers. And this is where I'm stuck in QGIS. There's a very handy "batch processing" function for every tool, but I can't figure out how to run this for this (rather simple?) process of creating buffers around points.

Any tips on this?

1 Answer 1

2

Short answer

First create 50 squares with Geometry by expression. Then split the layer, based on the area of the squares to get individual layers for each size.

Detailed answer

  1. To create 50 squares with side lenghts 10, 20, 30, ... 500, centered at the points of a point layer, you can use QGIS expressions with Geometry by expression (see here for details). Use this expression:

    collect_geometries (
       array_foreach(
            generate_series(10,500, 10),
            make_square( 
                project (centroid ($geometry), sqrt (@element^2/2), radians(45)),
                project (centroid ($geometry), -sqrt (@element^2/2), radians(45))
            )
        )
    )
    

The expression in action, here creating the squares with Geoemtry Generator, based on the blue point: enter image description here

  1. Run Multipart to single parts when finished to get individual features for each square.

  2. To get individual layers for each size to a separate layer (all polygons with side length 10, all with length 20 etc.), create an attribute area with Field calculator and the expression area ($geometry). So you can group together all polygons with the same area.

  3. Run Menu Processing > Toolbox > Split vector layer and set the field created in step 2 as Unique ID field. You will get 50 separate layers.

50 vector layers created, one for each size: 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.