More

Average width of irregular polygons QGIS 2.12.0 Lyon

Average width of irregular polygons QGIS 2.12.0 Lyon


I'm interested in examining the average width of streets, that are irregular polygons, for a project. I'm using QGIS 2.12.0 Lyon, and have lines (power cables) and Polygons (streets) as layers. For further analysis I need to know how wide the streets, which overlap with cables, are on average. I already found a try of a solution for this topic at How can I calculate the average width of a polygon?, but unfortunately I don't get rid of error Messages when I try to apply Peter Krauss's solution in QGIS and I get told it's better to create a new question instead of asking there . It's quite plain to me, that there's no perfect solution for finding the average width for irregular Polygons, but approximatly would be absolutly enough for me. Especially because my knowledge in programming is actually a lot to bad for this.

If the power cables layer overlaps the street layer crosswise, I can use the length of the new layer which is created by intersection.

(street = blue, cable = black, intersect= orange)

But if the cable don't overlap crosswise but along the street, I need the average width of the street and not a punctual selection at one point because the width can change. Also there could be curves or crossroads in the street, what makes it even worse.

(street = blue, affected part of the street layer =purple , cable = black, intersect= orange)

Futhermore I'm actually searching for an way in which you don't have to do that much manual work like drawing lines, but rather a solution in which you can recall the average width of every street any times.

Perhaps someone can explain all necessary steps so I can use it?


You can start from two known values the area and the perimeter ($area and $perimeter in the filed calculator). As you need an average width, let's imagine we have a rectangle (length, width)

Area = length x width Perimeter = 2 x (length + width)

We have two unknowns and two (non linear) equations, let's substitute length from the first to the second:

length = Area / width Perimeter = 2 x Area / width + 2 x width

Let's multiply the second equation with width and rearrange to get a quadratic equation for width:

2 x width ^ 2 - Perimeter x width + 2 x Area = 0

Solving this you get two roots, the smaller positive value is an average width. It can be used in field calculator to calculate width for each polygon.


This answer isn't specific to QGIS.

(perimeter/pi) / (perimeter**2 / (4*pi) / area)

That is:

Diameter of a circle with the same perimeter as the polygon ---------------------------------------------------------------- (Area of a circle with the same perimeter as the polygon) / Area

Edit: Writing the formula this way makes the logic of it much clearer:

(perimeter / pi) * area / (perimeter**2 / (4*pi)) (Diameter of a circle with the same perimeter as the polygon) * Area / (Area of a circle with the same perimeter as the polygon)

See more detail--and an ArcPy implementation--here.


Watch the video: Finding errors and correcting overlapping features and slivers in QGIS fast and easy