Longest Line Within a Polygon

16905
10
04-16-2014 01:45 PM
RafaelRuas_Martins
Occasional Contributor
Hi,
I'd like to model the longest possible line within a (irregular ou regular) polygon feature.
The line should be a 100% inside polygon!!!
Someone knows a tool for that task?
I am using ArcGIS for Desktop 10.2.1.
Tks.
Rafael
0 Kudos
10 Replies
VinceE
by
Frequent Contributor

Thanks for sharing! None of the below is criticism, just observations; I think both of our approaches are good for different scenarios, and your version has shown me some errors and improvements in my own version.

I like your approach because it may be more applicable than mine for some real-world situations. My computer would catch fire (or just take forever) if I tried to use my code to process a real-world island polygon because there would likely be hundreds of thousands (more?) of vertex pairs, a problem that you solve by "generalizing" with "Generate Points Along Line." So, I will implement this change in my own tool based on a total vertex count or something like that.

Reviewing your approach has also shown me that while I still stand behind my edge transect approach, my internal line approach is INCORRECT. So, thanks for offering a different perspective.

My longest line (measurements all in US Feet) is shown in Black, yours is in Red, and my (I am now realizing) incorrect "entirely internal" line is shown in Blue. So, disregard Blue, I need to remove that feature.VinceE_0-1681507257472.png

For absolute accuracy, I think my two-vertex algorithm is the best approach, but for realistic use on complex polygons (islands, parcels, etc.) your approach could likely get pretty darn close, and probably requires far less processing time. Another exampl--again, mine in Black, yours in Red:

VinceE_2-1681507550872.png

 

Another thing to watch out for with your toolbox would be holes in polygons, as well as concave polygons. As you can see, your line is "longer" here, but passes through a hole. The second image shows your line going out of bounds in a concave polygon.

VinceE_1-1681507488217.png

VinceE_3-1681508012512.png

 

Thanks for the alternate approach, very helpful in thinking about this problem further.

 

0 Kudos