22

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

2 Answers 2

28

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

example

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

0

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.