23

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
Taras
  • 32,823
  • 4
  • 66
  • 137
Lilium
  • 1,057
  • 1
  • 6
  • 17

2 Answers2

29

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

example

Taras
  • 32,823
  • 4
  • 66
  • 137
21

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

Taras
  • 32,823
  • 4
  • 66
  • 137
Kadir Şahbaz
  • 76,800
  • 56
  • 247
  • 389