7

I want to change the shape of all polygons within a layer into circles and maintain their original size. All polygons are different sizes and shapes at the moment, based on the extent of wind power sites.

I have not found a way how to actually create new, circular polygons at all. It seem like "Geometry by expression" could be a tool for this, but I have never used it and don't know the expression to achieve this.

3
  • 1
    There are several ideas that came into my mind: [1] "Minimum bounding geometry" with Minimum Enclosing Circle or directly via the "Minimum enclosing circles"
    – Taras
    Oct 12, 2021 at 7:56
  • 1
    [2] similar to this but using one of these expressions minimal_circle($geometry, ...) or make_circle(centroid($geometry), ...). BTW what are the pre requirements for your radius?
    – Taras
    Oct 12, 2021 at 7:58
  • What I want to do is to create the circles with the same area as the initial polygon in square meters (or other unit). These options only give circles around the initial polygon, resulting in a larger area.
    – Erik
    Oct 12, 2021 at 8:17

2 Answers 2

8

To get circles with equal area, run Geometry by expression with:

make_circle(
    point_on_surface( $geometry ),   -- centroid( $geometry )
    sqrt( $area / pi() )
)

Here, the resulting circle centers on a point that is guaranteed to lie on the surface (point_on_surface()) of the initial Polygon. This is likely a different location than the centroid(), which is point-set weighted and may lie outside an irregular shape (or MultiPolygon) - you will have to decide which one suits best.


There are plenty of other built-in methods to create circles with relation to shape and size of the intial Polygons, including the minimal_circle() function you can use inside the expression.

4
  • The last point and (many) more options are already covered by @Taras comments.
    – geozelot
    Oct 12, 2021 at 8:00
  • Thanks a lot! This is exactly what I needed. Great support!
    – Erik
    Oct 12, 2021 at 8:45
  • @BERA ...I assumed // is galactic Basic for inline comment. I added a disclaimer.
    – geozelot
    Oct 12, 2021 at 10:38
  • 1
    The syntax for comments in QGIS expressions is the same as in SQL. Just use --, then you can just copy paste the code with no need to remove comments.
    – MrXsquared
    Oct 12, 2021 at 11:45
6

If this is about symbology and you don't need to do any operations on the circles later on, you may use a centroid fill.

You can force this point to be placed inside the polygon by checking the corresponding checkbox.

As to the size of the point, you need to set the units to map units. Then head for the data defined override of the symbol size. Hit edit, then enter the following: sqrt($area/pi())*2

This calculates the radius of a circle which has an area equal to the polygon it belongs to. $area grabs the area of the curent feature, pi() is Pi, and sqrt() returns the square root. We need to multiply this value by 2, since the size of point symbols in QGIS is defined by their diameter, not their radius.

The result looks as follows:

enter image description here

As said, this doesn't allow you to do geometrical operations on the circles, but it preserves you existing polygons (which in my opinion is more important in this business).


A word of advice: Overlaying features with value-indicating symbols is considered bad cartographic practice. Adding the value as a label, or using categories and a matching legend in order to indicate the value leads to better understanding of the map.

1
  • +1 for keeping base data intact. I'd try to use Labels though, and not render the geometries at all.
    – geozelot
    Oct 12, 2021 at 20:54

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.