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
  • Can you provide example data? Do you need the actual geometry of the rectangles, or would the geometry generator suffice? – Erik Sep 9 at 12:47
  • What kind of solution are you open to ? Would a python solution work for you for example or something else ? – Louis Cottereau Sep 9 at 12:53
  • @LouisCottereau actually i will try to write a script. but i need a tool or plugin for now. – Lilium Sep 9 at 12:56

Check "Rectangles, Ovals, Diamonds (Variable)" in the QGIS's Toolbox



| improve this answer | |

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_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


enter image description here

| improve this answer | |
  • 2
    Thank you. This also worked, but @Taras's solution is more convenient to apply. – Lilium Sep 9 at 13:21

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.