6

In QGIS 3.28.10 I need to draw a perfect square (polygon) in a shapefile. I know each side is 20 meters.

4
  • I'm using QGIS 3.28.10
    – Agos
    Commented Jul 30 at 13:57
  • Have you read that : docs.qgis.org/testing/en/docs/user_manual/working_with_vector/… ?
    – J.R
    Commented Jul 30 at 14:13
  • There are very few perfect squares in nature, or GIS -- The Earth is a geoid, after all. You may need to downsample your definition of perfection.
    – Vince
    Commented Jul 30 at 19:32
  • 3
    There are very few perfect things in life in general
    – Agos
    Commented Jul 31 at 13:31

3 Answers 3

13

You can use the "Advanced digitizing panel".

Extract from the manual: The Advanced Digitizing panel can be opened either with a right-click on the toolbar, from the View ► Panels ► menu or by pressing Ctrl+4.

The panel looks like this:

Advanced digitizing panel

Then:

  1. Enable editing on the layer
  2. Use the standard "Add polygon feature" to start adding the square
  3. In the "Advanced digitizing" panel, click the button at the top left ("Enable advanced digitizing").
  4. On the map, click where you want to put the first point of the square
  5. In the "Advanced digitizing" panel, in the top field (d) fill out the desired distance: 20 in your example. To the right of that field, enable the 2 "lock" buttons so the tool remembers this distance also for all following sides of the square.
  6. In the "Advanced digitizing" panel, in the second field (a) fill out the desired angle: 90 for a rectangle/square. To the right of that field, enable the 2 "lock" buttons so the tool remembers this distance also for all following sides of the square.
  7. In the map, add the 3 extra points of the square. The settings chosen above will make sure the angles are square and the sides are all 20 long.
  8. Right-click to close the square.

Step 3 will be remembered if you add more squares.

In addition, if you want to draw multiple squares of the same size in the same neighbourhood, you can consider using the copy and move features tool on the "advanced digitizing" toolbar to make the copies.

2
  • 2
    Note that the Advanced Digitizing panel only work with layer in a projected CRS
    – J.R
    Commented Jul 30 at 15:25
  • 1
    Thank you, that's very useful!
    – Agos
    Commented Jul 31 at 13:39
6
  1. Place a point at each square’s center location.
  2. Buffer each point by 1/2 of the square side length, i.e. 10 m.
  3. Run the tool: Processing > Vector Geometry > Bounding Boxes, using the buffer layer as input.
  4. Voila!
5

If you need to draw many squares this can be an option:

  1. Create a point layer, I'm using a temporary scratch layer
  2. Create a virtual layer which buffers the points and envelope the buffers, to create the squares:

enter image description here

Change 200.0 to the the half the square size you want (10), and My point layer to the name of your point layer. Execute the query and "Load as new Layer"

select row_number() over() as id, st_envelope(st_buffer(geometry, 200.0, 16)) as geometry
from "My point layer"
  1. Place a point in the center of where you want to create a square. A square is automatically created in the virtual layer.
  2. Copy and paste the square to your polygon layer: 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.