public BoundingCircle(IGeoArray geoArray)
 {
     Center = geoArray.Center;
     Radius = geoArray.Geos.Max(g => Center.DistanceRadians(g));
 }
 /// <summary>
 /// Is one region's boundary within 'near' range of a region? Note: good practice is s describes a smaller area than r.
 /// </summary>
 /// <param name="s"></param>
 /// <param name="r"></param>
 /// <param name="near"></param>
 /// <returns>True if at least one point is within range, false otherwise</returns>
 public static bool IsNear(this IGeoArray s, IGeoArray r, double near)
 {
     return s.Segments.SelectMany(sSegment => r.Segments.Select(rSegment => sSegment.Intersection(rSegment, near)).Where(ret => ret != null)).FirstOrDefault() != null;
 }
 /// <summary>
 /// Is one region's boundary within 'near' range of a region? Note: good practice is s describes a smaller area than r.
 /// </summary>
 /// <param name="s"></param>
 /// <param name="r"></param>
 /// <param name="near"></param>
 /// <returns>List of Geo where the polys intersect within the range, empty list if the condition wasn't met.</returns>
 public static GeoArray Near(this IGeoArray s, IGeoArray r, double near)
 {
     return new GeoArray(s.Segments.SelectMany(sSegment => r.Segments.Select(rSegment => sSegment.Intersection(rSegment, near)).Where(ret => ret != null)));
 }
 public static bool IsSelfIntersecting(IGeoArray geoPoly)
 {
     var segments = geoPoly.Segments.ToArray();
     for (var i = 0; i < segments.Length; i++)
     {
         var segment1 = segments[i];
         for (var j = i + 1; j < segments.Length; j++)
         {
             var segment2 = segments[j];
             if (segment1.Intersects(segment2)) return true;
         }
     }
     return false;
 }