# How to calculate the length of polygons?

2109
8
06-10-2019 02:55 AM
Highlighted
by
New Contributor

Hi all,

I am looking for a tool that would allow me to draw a line in the middle of polygons to calculate the total length of my polygons. I do not have access to the tool 'polygon to centreline'. I would like to avoid drawing the line in the middle of each individual polygon. I received the shapefile with more than 2800 polygons.  Any ideas?

Best,

Elise

8 Replies
Highlighted
MVP Esteemed Contributor

That is the tool to use.

You could see if there are any implementations in python for 'medial axis' or 'polygon skeleton', but I suspect that you won't find any that can be easily implemented in a script

Highlighted
MVP Esteemed Contributor

As an after thought

one of the rectangle variants since they provide axis information.

Might suffice if your polygons are fairly regular.

Highlighted
MVP Esteemed Contributor

I am not totally clear what definition of length you are thinking of for your polygons.  If you grab the extent for each polygon, that will give you the maximum and minimum Xs and Ys, which is one way of figure out width and height, depending on what you are interested in calculating.

Highlighted
MVP Esteemed Contributor

Joshua, that works if the polygons are axis oriented.  For oriented, quasi-regular polygons, the quick minimum area bounding rectangle or what esri calls the 'rectangle by width' are good approximations.  For completely irregular or tortuously shaped polygons (ie picture a snake), the medial axis or polygon skeleton are approaches.  These can be derived through polygon triangulation or incremental negative buffers until you are left with intersection points as the polygon devolves to points... connect the points and you have an approximation of the internal 'axial line' of the polygon

Highlighted
MVP Esteemed Contributor

Agreed.  It isn't clear an axial definition is exactly what he is after, although he does reference the polygon to centerline tool, so he likely is.

Highlighted
by
New Contributor

Thank you for your help Joshua Bixby and Dan Patterson

I will try to the polygon skeleton and medial axis approaches. My polygons are a mix between regular shapes and irregular shapes.

Highlighted
by
New Contributor III

Hi Elise. To achieve this in ArcGIS for a river centreline, I've used the Create Thiessen Polygons tool.  If you convert the polygons to lines, then split the lines into small segments (the smaller the segment, the smoother the centre-line), then create points from the line segments - creating Thiessen polgons from these points will create a centre-line in the middle for any irregular polygon - albeit with a bit of superfluous geometry.

I had to manually edit to leave only the centre-line, but there might be a way to do this without manually editing.  Which you'll need with over 2800 polys 🙂

Highlighted
MVP Esteemed Contributor

John, that is the polygon triangulation method mentioned here