import arcpy arcpy.env.overwriteOutput = True inFC=r'C:\Path\To\MultiPartFeatureClass.shp' rows = arcpy.da.UpdateCursor(inFC,("SHAPE@")) for row in rows: geom=row[0].type.capitalize() #returns Point, Polygon, Polyline, or Multipoint. exec('row[0]=arcpy.'+geom+'(row[0].getPart(0))') #executes line for appropriate geometery rows.updateRow(row) del row del rows
infc =r'C:\MultiPartFeatureClass.shp' outfc = r'C:\FisrtPartFeatureClass.shp' newarray = [] for row in arcpy.da.SearchCursor(infc, ["OID@", "SHAPE@"]): partnum = 0 for part in row[1]: if partnum == 0: thispart = [] for pnt in part: if pnt: thispart.append([pnt.X, pnt.Y]) partnum += 1 newarray.append(thispart) features = [] for feature in newarray: features.append(arcpy.Polyline(arcpy.Array([arcpy.Point(*coords) for coords in feature]))) arcpy.CopyFeatures_management(outfc, SingleParts)
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.