private static IGeometry SinglePolygonToLine(IGeometry polygon) { IEnumerable <IEnumerable <IPoint> > coordinates = polygon.GetCoordinates(); if (coordinates.Count() > 1) { return(MultiLineString.Create(coordinates.Select(a => a.ToArray()).ToArray())); } else { return(LineString.Create(coordinates.First().ToArray())); } }