# Selecting polygons with a minimum internal straight line value - ArcGIS 10

I have a map of polygons representing forest stands. I am trying to sort through them to find those polygons that have a minimum internal distance of 200 m in a straight line (my field sampling will consist of ground truthing the stands, and will require a 200 m line to fall within the stand).

I have tried to find if there is an automated way to do this, which there doesn't appear to be. There was something made thats no longer applicable for arcgis 10 ( http://www.jennessent.com/arcview/longest_lines.htm ).

If it comes to it, I don't mind eyeballing the distance, and drawing a line myself. But I can't seem to figure out a way to draw it so that I can pull geographic coordinates off of it. As in, when I draw two points I somehow convert the drawn points to a feature set of X and Y coordinates. All I can figure out is just doing it by hand, and viewing the values at the bottom right of the screen and recording them by hand.

Thanks in advance, and let me know if you need anything cleared up, not great at explaining my problems (probably why I can't find anything online too).

Ayden

• Regarding the manual method you can use the Add XY Coordinates (help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//…) tool to create X and Y fields with your points shapefile. The tool uses whatever projection/coordinate system the shapefile is in to calculate, so if you want lat/lon you'll need your shapefile to be in a geographic coordinate system rather than a projected coordinate system. Apr 17, 2012 at 21:38
• Does this work for hand drawn points, if so I can't seem to get it to work? I unfortunately don't have a dataset of X Y coordinates but am hoping to be able to extract the coordinates from hand drawn points that I place myself. Apr 17, 2012 at 21:51
• Just create an empty shapefile in ArcCatalog, start an editing session in ArcMap, add points as needed, then save your edits. Once you have all the points you want, close the editing session, then use the Add XY Coordinates tool and it will add an X and Y field to your attribute table. Apr 17, 2012 at 22:10
• Ah, excellent, thanks for that Baltok. Going to try the Spatial Ecology solution overnight tonight, if it doesn't work I will likely use this strategy here. Apr 18, 2012 at 0:57

It sounds like the "Calculate Fetch in Polygons" command in SpatialEcology's Geospatial Modelling Environment (GME) should produce what you are looking for.

This tool estimates the longest straight line that can be positioned within a polygon, without crossing any edges. It corresponds to the 'fetch' of a lake: the longest stretch of water over which waves can build up as a function of wind action. The calculation is based on evaluating the lines created by connecting all pairs of non-neighbouring vertices and retaining the longest line that does not cross any interior or exterior boundaries of the polygons. This is a brute force algorithm that can take a long time for very complex polygons (e.g. polygons with more than 1000 vertices).

• +1. But note that "This is a brute force algorithm that can take a long time for very complex polygons." If you have access to medical imaging software or general-purpose math SW (Mathematica or MatLab), you can find the direction of a longest line relatively quickly in many cases by means of the Radon transform. Then it's quick to find the position of that line, given its orientation. The calculation is not exact--the line can cut across "inlets" in the stand--but for many purposes that's a good feature. Apr 17, 2012 at 22:37
• Yup, that looks like it does it. But man it takes ages. Thanks, I've come across SpatialEcology before but didn't realize that it had this option. Apr 18, 2012 at 0:55
• Whuber, I need to track down MatLab, see if the school offers a student copy or not. Thanks for the tip though, I'll keep it in mind. Apr 18, 2012 at 0:57

+1 for @blah238's answer, but if you want to use built-in ArcGIS 10 tools, a simplistic approach is to use the Minimum Bounding Geometry tool with the CONVEX_HULL (ArcInfo only) or RECTANGLE_BY_WIDTH (All license levels) and select "Add geometry characteristics as attributes to output (optional)". This will generate a field with the length. As per @whubers comment: The calculation is not exact--the line can cut across "inlets" in the stand.

• Ah, I came across this answer but didn't note the "Add geometry characteristics as attributes to output" button. This works for some of the forest stands, but there are a lot that are very winding and unfortunately it doesn't quite do what I need it to. Much much faster than the SpatialEcology solution though. Apr 18, 2012 at 0:56

A Heath Robinson Solution (warning: this is not brute force but is a little fiddly) :

An alternative you could try (with a view to reducing the calculation overhead) is to use the CalculatePolygonMainAngle from the Cartography tools. This will give you the orientation for each polygon. Next you need to write a little code. Get the centroid of the polygon and shoot rays out along the + and - directions of the main angle for each polygon (you can judge how far by using the polygon's bounbing geometry - but be generous). Next clip the rays (lines) with the polygons and note their length. To make things easier, use the centroid as the mid point of your line and do some trig to calculate a start and end point orientated along the main angle.

If you are reasonable at writing scripts in ArcPy, this shouldn't be too hard. Just a thought... might help if your brute force approach is killing your computer :)

• Good info, but you can earn my upvote with some psuedocode or maybe even a running Python script :) Apr 19, 2012 at 6:37
• @blah238 He deserves the upvote, regardless. Oct 15, 2020 at 15:16