I have a large number (>1000) of polygons in a shapefile. I would like to measure their approximate length. The polygons are somehow elongated, so a quantity such as the length of longest line within a polygon, or the half of its perimeter, could be good approximations for the polygons' lengths. I am new to GIS. I can load the shapefile on Google Earth Pro for example, and manually measure these lengths. But this would be a very tedious and inaccurate work. I also have access to QGIS and Python.

In short: is there a way to obtain distances (in km) between the two farthest points in a polygon automatically, or the polygon's perimeter, given a large number of polygons in a shapefile?

Preferably using Python, QGIS or Google Earth Pro.

EDIT: Since my polygons are so elongated, I would be happy with approximating the length by half of the perimeter. This could actually be more accurate than the length of longest line within, because some polygons are also curvy.

  • See gis.stackexchange.com/questions/253242/… for a somewhat rigorous solution.
    – Martin F
    Aug 18, 2020 at 18:36
  • 1
    Measuring the length of a line/boundary can be problematic because it often depends much on scale or how detailed was it sampled. The greater the detail the longer the line.
    – Martin F
    Aug 18, 2020 at 18:37

2 Answers 2


You can use the add geometry attributes from the menu vector or the processing toolbox, see the documentation:


This calculates the perimeter. Use the field calculator to divide this value by 2 to get half the perimeter.


I suggest to use the "Oriented minimum bounding box" tool from the processing toolbox.

"This algorithm calculates the minimum area rotated rectangle which covers each feature in an input layer."

The output also contain the width, height, angle, perimeter and area of the bonding box. For mostly straight elongated polygon the width of the bounding box should be close to your mesure (the mesure will be in the unit of your layer CRS)

See the screencap below where the original polygon is green and the oriented bounding box is red.

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.