I have a shapefile with 9000 agriculture fields and what I like to do is to determine for each field (=each polygon) the direction of the longest segment. For instance, the selected polygon in the screenshot has its longest segment from west to east so I would like to mark give the polygon the attribute W (for west) or either E (for east).

Is there any solution to solve my problem in a fast but generalized way?

I do not need very detailed results. It's just for the interpretation of a question.

I'm seeking an answer using ArcGIS 10.2 for Desktop.

To be more precise on what I'm looking for I try to explain more practical: I'm doing winderosion analysis for a specific area with 9000 fields. As result I have a potential susceptibility for each field. I like to check, if the fields with high susceptibility are correlated to a certain orientation of the fields, e.g. check if most of the fields with high risk are oriented in the main winddirection or not.

The search for the longest segment is not really important for me. It was just an idea I had to determine the direction. So forget about the longest segment if there is a way to determine the direction with another method ;)


  • 2
    I'm not sure what you're looking for. You say the direction of the longest segment, but given there can be many vertices on the longest side, are you actually looking for the direction of greatest extent? And you say either east or west - the highlighted polygon is longest east/west, but the western line is longer than the eastern line. Are you looking for whether a field is mostly longer east-west or north-south (and how detailed do you want that direction to be - just the four cardinals, or nw-se, etc.)?
    – Chris W
    Jul 20, 2014 at 19:10
  • I think you would be better replacing your picture with one of just a single polygon that illustrates more clearly what "segment" you are calling the longest.
    – PolyGeo
    Jul 20, 2014 at 21:43
  • What you are asking for is an easy thing for a person to discern but a difficult task for a computer. You could try to centreline the polygons to get the trend line for the polygon or at the very least generalize/simplify the polygons so there's not so many vertices which should end up with straight lines for the sides. You would need to do some python to find the length of the segments though. It might work out better to use the extents (envelopes) of the polygons for your calculations. Jul 21, 2014 at 0:00
  • I edited my question and hope to make it more precise. @Chris W: would be enough to get the four cardinals
    – xmisx
    Jul 21, 2014 at 9:59

1 Answer 1


Assuming you just want the general orientation of the polygon, rather than a specific segment... try the Minimum Bounding Geometry (Data Management) ArcGIS tool with the RECTANGLE_BY_WIDTH or RECTANGLE_BY_AREA geometry type and the MBG_FIELDS option. The MBG_FIELDS option will add the following fields to the output attribute table:

  • MBG_Width—The length of the shorter side of the resulting rectangle.
  • MBG_Length—The length of the longer side of the resulting rectangle.
  • MBG_Orientation—The orientation of the longer side of the resulting rectangle.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.