Parameters
- layer
- The layer of the feature to split.
- oid
- The oid of the feature to split.
- splitGeometry
- The geometry to intersect the source feature.
| Exception | Description |
|---|---|
| System.ArgumentNullException | Layer cannot be null. |
// Cuts features in the specified feature layer using the provided cut line and clip polygon. await QueuedTask.Run(() => { var select = MapView.Active.SelectFeatures(clipPolygon); var cutFeatures = new EditOperation() { Name = "Cut Features" }; cutFeatures.Split(featureLayer, objectId, cutLine); //Cut all the selected features in the active view //Select using a polygon (for example) cutFeatures.Split(select, cutLine); //Execute to execute the operation //Must be called within QueuedTask.Run if (!cutFeatures.IsEmpty) { //Execute and ExecuteAsync will return true if the operation was successful and false if not var result = cutFeatures.Execute(); //or use async flavor //await cutFeatures.ExecuteAsync(); } });
// Modifies the "NAME" attribute of a specified feature and then splits the feature using the provided polyline, all within a single sequential edit operation. // perform an edit and then a split as one operation. await QueuedTask.Run(() => { var newName = "Modified then Split"; var queryFilter = new QueryFilter() { WhereClause = "OBJECTID = " + objectId.ToString() }; // create an edit operation and name. var op = new EditOperation { Name = "modify followed by split", // set the ExecuteMode ExecuteMode = ExecuteModeType.Sequential }; using (var rowCursor = layer.Search(queryFilter)) { while (rowCursor.MoveNext()) { using var feature = rowCursor.Current as ArcGIS.Core.Data.Feature; op.Modify(feature, "NAME", newName); } } op.Split(layer, objectId, splitLine); if (!op.IsEmpty) { bool result = op.Execute(); } // else // The operation doesn't make any changes to the database so if executed it will fail });
// Splits the specified feature at the given points. await QueuedTask.Run(() => { //Split features at given points //Split features using EditOperation.Split overloads var splitFeatures = new EditOperation() { Name = "Split Features" }; //Split the feature at given points splitFeatures.Split(featureLayer, objectId, splitPoints); //Execute to execute the operation //Must be called within QueuedTask.Run if (!splitFeatures.IsEmpty) { //Execute and ExecuteAsync will return true if the operation was successful and false if not var result = splitFeatures.Execute(); //or use async flavor //await splitAtPointsFeatures.ExecuteAsync(); } }); // Splits a feature in the specified feature layer based on a given percentage and object ID. await QueuedTask.Run(() => { var percentage = 25.0; //Split features using EditOperation.Split overloads var splitFeatures = new EditOperation() { Name = "Split Features" }; // split using percentage var splitByPercentage = new SplitByPercentage() { Percentage = percentage, SplitFromStartPoint = true }; splitFeatures.Split(featureLayer, objectId, splitByPercentage); //Execute to execute the operation //Must be called within QueuedTask.Run if (!splitFeatures.IsEmpty) { //Execute and ExecuteAsync will return true if the operation was successful and false if not var result = splitFeatures.Execute(); //or use async flavor //await splitAtPointsFeatures.ExecuteAsync(); } }); // Splits a feature in the specified feature layer into the specified number of parts. await QueuedTask.Run(() => { var numParts = 3; // split using equal parts //Split features using EditOperation.Split overloads var splitFeatures = new EditOperation() { Name = "Split Features" }; var splitByEqualParts = new SplitByEqualParts() { NumParts = numParts }; splitFeatures.Split(featureLayer, objectId, splitByEqualParts); //Execute to execute the operation //Must be called within QueuedTask.Run if (!splitFeatures.IsEmpty) { //Execute and ExecuteAsync will return true if the operation was successful and false if not var result = splitFeatures.Execute(); //or use async flavor //await splitAtPointsFeatures.ExecuteAsync(); } }); // Splits a feature in the specified feature layer at a given distance and object ID. await QueuedTask.Run(() => { var distance = 150.0; //Split features using EditOperation.Split overloads var splitFeatures = new EditOperation() { Name = "Split Features" }; // split using single distance var splitByDistance = new SplitByDistance() { Distance = distance, SplitFromStartPoint = false }; splitFeatures.Split(featureLayer, objectId, splitByDistance); //Execute to execute the operation //Must be called within QueuedTask.Run if (!splitFeatures.IsEmpty) { //Execute and ExecuteAsync will return true if the operation was successful and false if not var result = splitFeatures.Execute(); //or use async flavor //await splitAtPointsFeatures.ExecuteAsync(); } }); // Splits a feature in the specified feature layer at a given distance and object ID. await QueuedTask.Run(() => { var distances = new List<double> { 100.0, 200.0, 50.0 }; //Split features using EditOperation.Split overloads var splitFeatures = new EditOperation() { Name = "Split Features" }; // split using varying distance var splitByVaryingDistance = new SplitByVaryingDistance() { Distances = distances, SplitFromStartPoint = true, ProportionRemainder = true }; splitFeatures.Split(featureLayer, objectId, splitByVaryingDistance); //Execute to execute the operation //Must be called within QueuedTask.Run if (!splitFeatures.IsEmpty) { //Execute and ExecuteAsync will return true if the operation was successful and false if not var result = splitFeatures.Execute(); //or use async flavor //await splitAtPointsFeatures.ExecuteAsync(); } });
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)