AnsweredAssumed Answered

GeometryEngine.Cut doesn't split into multiple geometries

Question asked by maxmaxmaxmaxmax on Jan 13, 2017
Latest reply on Jul 18, 2017 by maxmaxmaxmaxmax

I'm trying to split a polygon by multipart polyline (created from multiple polylines with GeometryEngine.Union) using GeometryEngine.Cut method expecting multiple (more than 2) geometries as the result. But I get empty collection... In ArcObjects I can do this easily with ITopologicalOperator4.Cut2 method.


Test data is attached – If you execute this code you'll get an empty collection as the result of GeometryEngine.Cut method.


using (var geodatabase = new Geodatabase("Data.gdb"))
    // Construct unified line to cut by

    var lines = new List<Polyline>();

    using (var linesFeatureClass = geodatabase.OpenDataset<FeatureClass>("Lines"))
    using (var linesCursor = linesFeatureClass.Search())
        while (linesCursor.MoveNext())
            var polyline = GeometryEngine.SimplifyAsFeature(((Feature)linesCursor.Current).GetShape(), true) as Polyline;

    var unifiedLine = GeometryEngine.SimplifyAsFeature(GeometryEngine.Union(lines), true) as Polyline;
    // Get polygon to be cut

    Polygon polygon = null;

    using (var polygonsFeatureClass = geodatabase.OpenDataset<FeatureClass>("Building_pol"))
    using (var polygonCursor = polygonsFeatureClass.Search())
        while (polygonCursor.MoveNext())
            polygon = GeometryEngine.SimplifyAsFeature(((Feature)polygonCursor.Current).GetShape(), true) as Polygon;

    // Cut polygon by unified line
    var parts = GeometryEngine.Cut(polygon, unifiedLine); // parts will be empty collection


Input data:


Expected result: