Select to view content in your preferred language

How calculate the length and wide of a rectangle (shape)

4781
10
10-06-2016 05:27 AM
MaximeGuillois
Deactivated User

I have a shape file witch is a rectangle and I want to calculate the length of the side of this rectangle.

0 Kudos
10 Replies
NeilAyres
MVP Alum

Can't you just measure it?

0 Kudos
MaximeGuillois
Deactivated User

it's a manual solution, there is no automatic solution ?

Thank you

0 Kudos
AdrianWelsh
MVP Honored Contributor
MaximeGuillois
Deactivated User

   Perfect !! thank you.

I'll try it and come back to told you if everything is fine

0 Kudos
DanPatterson_Retired
MVP Emeritus

The extent rectangle or minimum area bounding rectangle (MABR) should be appropriate... the latter provides information on the widths measured along the axes of the shape and not the X, Y axes the extent rectangle measures the X,Y axes lengths.  MABR also provides orientation if I am not mistaken.

MaximeGuillois
Deactivated User

I've found a way aith mathematics. I calcul the lenght thanks to the perimeter and the air

easy !

0 Kudos
DanPatterson_Retired
MVP Emeritus

of course you can compare those result by doing it by just adding a a perimeter field in the MABR output and calculate the perimeter.. but be careful the perimeter of a 1 m square is 4 m, divided by the area would give a width of 4 m by your suggestion... obviously not correct... I think you mean if you get one of the width or length and the area, you can calculate the other.

0 Kudos
MaximeGuillois
Deactivated User

With an equation with two unknow:

P=2L+2l

A=L*l

You can have L and l

0 Kudos
DanPatterson_Retired
MVP Emeritus

that is for rectangles.  Take an isoceles triangle, rotate it by 22.5 degrees, assume that the base is 1 unit but the lengths of the sides are unknown.  Yes... I can manually do the 'math'. but lets assume you have 1000000 irregular shapes and need to get a measure of the 'length' and 'width' of the shape.  There is no such thing for a convex or concave polygon, however one can fit a Minimum Area Bounding Rectangle to the shape, from which you get the characteristic long and short axes.  From this you get the area of the rectangle... you can then calculate the actual area and perimeter  From there you can calculate all kinds of 'shape' geometric properties... area/area ratios, MABR perimeter/shape perimeter etc etc.  So unless you are working with pure geometric properties with only a couple of shapes, then you can either do the 'math' by hand, do all kinds of field calculations or use the results of existing tools.

Also by calculating the enclosing circle, MABR and convex hull, you enter a whole new level of shape descriptors.  I haven't even mentioned the Minimum Area Bounding Ellipse that can also be thrown in.  The geometric shapes that can be calculated and classed as containers are quite extensive in number and they each have their own purpose.  Don't limit yourself to hand calculations or simple geometry when assessing what tools are useful, because you will encounter a situation where you might have gained some useful information by applying existing tools to new problems.