20

I have a layer which contains points. The layer has "height" and "width" attributes.

I need rectangles around those points, but a point should be in the center of the related rectangle whose height and width value comes from the point attributes.

Is there any tool?

enter image description here

Example data for three points:

height   width
20       12
6        10
4        14
0
27

Check the "Rectangles, Ovals, Diamonds (Variable)" geoalgorithm in the QGIS's Processing Toolbox (Ctrl+Alt+T)

example

19

There is "Geometry by Expression" tool. You should use in a projected coordinate system.

  • Select "Polygon" as "Output geometry type" option.

  • Click "Expression" button (highlighted blue square)

  • And paste the following expression

    make_rectangle_3points(
      make_point($x + "height"/2, $y + "width"/2),
      make_point($x - "height"/2, $y + "width"/2),
      make_point($x - "height"/2, $y - "width"/2)
    )
    

enter image description here

Result:

enter image description here

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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