arcgis python 把一个图层数据合并在一起
def getLayerGeomtry(inFeature): num=getCount(inFeature) mytemp=inFeature if num>1:#融合在一起 mytemp="in_memory/gisoracle" arcpy.Dissolve_management(inFeature, mytemp,"", "", "MULTI_PART") desc = arcpy.Describe(mytemp) shapefieldname = desc.ShapeFieldName rows = arcpy.SearchCursor(mytemp) for row in rows: pgeometry=row.getValue(shapefieldname) if row: del row if rows: del rows return pgeometry #到Pro中使用 def getLayerGeomtryPro(inFeature): desc = arcpy.Describe(inFeature) shapefieldname = desc.ShapeFieldName rows = arcpy.SearchCursor(inFeature) i=0 for row in rows: if i<1: pgeometry=row.getValue(shapefieldname) else: pgeometry=pgeometry.union(row.getValue(shapefieldname)) i=i+1 if row: del row if rows: del rows return pgeometry
pgeometry=getLayerGeomtry(inFeature)
yl_tmp = arcpy.CreateUniqueName("yl_tmp") #临时数据
arcpy.Select_analysis(pgeometry, yl_tmp, '')