arcpy.management.SplitLineAtPoint(in_features, point_features, out_feature_class, {search_radius})
The above code line outputs the split features to a new feature class or rewrites an existing feature class. I want the split features to be output to the original SDE line feature class. It seems not doable. I got the feature class exists message.
I need to have split features in the original line feature class and delete the original feature after the feature is split. If the split features have to be in another feature class then I have to add them back. I am wondering if it is a better way to create new features based on the line's start/endpoints and the split point.
I'd like to know if there is a better way to do this.
Thanks
The obvious would be to edit the features that you need to change, but you obviously have many to do and this wouldn't be an option.
Overwriting anything without a backup is obviously not recommended, so creating a new featureclass would be best if editing isn't an option.
If you are certain that replacing the original feature class is safe, try adding arcpy.env.overwriteOutput = True before you call the gp tool.
I only want to add the split features to the original feature class -- the one contains feature to be split, not overwrite the feature class. I want the split to behave like the split tool in ArcGIS Pro. I guess it is not doable. I may have to create two new features and insert them to the original feature class.
Thanks.
If you add the split features to the original feature class, then you'll have duplicate features: the original lines and the split lines. If that what you want, just use Append.
The reason I need to have new features and original feature coexist in the feature class is that I have to copy non-system attributes to the new features and length fields need to have the calculation done. once I finish the processing of the attribute I can delete the original feature.
I tested append it worked. However, the field mapping is a problem. I do not know which line feature class is the editing layer so I can not hard-code the fields. in theory, new features have same fields as the original one. Do not know why the fields do not match. Any suggestion?
Thanks.
Either run the split tool manually in ArcGIS Pro or output the result to a file geodatabase so you can see what it looks like. Compare the fields yourself and see if anything changes and make the field mappings accordingly. Alternatively, use the "NO_TEST" schema_type option for Append:
Fields from the input dataset do not need to match the fields of the target dataset. Any fields from the input datasets that do not match the fields of the target dataset will not be mapped to the target dataset unless the mapping is explicitly set in the Field Map parameter.
make a copy as suggested earlier, then append