Select to view content in your preferred language

Splitting large amount of features

09-20-2019 05:46 AM
New Contributor II

We are publishing a geoprocessing service that will split a large amount of features in a file geodatabase.  The script uses the arcpy.defense.SplitFeatures() method, a ResourceSrf layer or a user passed in shapefile grid to split the features, so any features that fall within the grid or ResourceSrf should be split by the grid/ResourceSrf cell size.  

The issue we are facing is that some features are split, while others are not, particularly polygon features.  I am wondering if this is the best approach to splitting a large amount of features? Of course the documentation for this method is sparse at best.  Below is the code that splits the features.  Any help, information, or insight into splitting features would be greatly appreciated!

def splitter(gdb_to_split, use_alt_surface):
    gdb_exchange_folder = os.path.join(r'F:\Exchange\Rework_Temp', gdb_to_split[:-4])
    gdb_to_split = os.path.join(gdb_exchange_folder, gdb_to_split)
    gdb_to_split_tds = os.path.join(gdb_to_split, 'TDS')

    if use_alt_surface:
        gdb_resource_srf = os.path.join(gdb_exchange_folder, 'clip_shape.shp')
        gdb_resource_srf = os.path.join(gdb_to_split, 'TDS', 'ResourceSrf')

    physio_srf = os.path.join(gdb_to_split_tds, 'PhysiographySrf')

    target_features = r''
    arcpy.env.workspace = gdb_to_split_tds
    fcl = arcpy.ListFeatureClasses()
    for fclass in fcl:
        desc = arcpy.Describe(fclass)
        if desc.shapeType in ('Polygon', 'Polyline') and not in ('ResourceSrf', 'MetadataSrf', 'PhysiographySrf'):
            target_features += os.path.join(gdb_to_split_tds, fclass) + ';'
    target_features = target_features[:-1]
, "split_shape")"split_shape", "ARE_IDENTICAL_TO", gdb_resource_srf)

    arcpy.defense.SplitFeatures("split_shape", target_features)

0 Kudos
0 Replies