Is it possible to create feature dataset, based on the name from group layers. I have two separate codes, one for finding out the names of group layers, and other to create feature datasets.
>>> import arcpy
mxd = arcpy.mapping.MapDocument("CURRENT")
for lyr in arcpy.mapping.ListLayers(mxd):
if lyr.isGroupLayer == True:
if lyr.longName.find('\') == -1:
print lyr.longName
This is the code for searching the name of datasets, and this is the code to create feature datasets.
>>> arcpy.env.overwriteOutput = True
fdList = ["Dataset_A", "Dataset_B", "Dataset_C"]
folList = ["D:\GIS_TempFolder A", "D:\GIS_Temp\Folder B", "D:\GIS_Temp\Folder C"]
workRange = range(len(fdList))
for thisIndex in workRange:
fd = fdList[thisIndex]
arcpy.env.workspace = folList[thisIndex]
arcpy.CreateFeatureDataset_management("D:\GIS_Temp\TEST.gdb", fd, "D:\GIS_Temp\Projection.prj")
for impFC in arcpy.ListFeatureClasses():
fcName,fcExt = os.path.splitext(impFC)
fcName.replace(" ","_")
arcpy.FeatureClassToFeatureClass_conversion(os.path.join(folList[thisIndex],impFC),os.path.join("D:\GIS_Temp\TEST.gdb",fd),fcName)
Is it possible to merge the two codes, into one, so the name fdList = ["Dataset_A", "Dataset_B", "Dataset_C"]
, would actually be names returned from the group layers based on the first code? I am trying to merge these two codes, so the searched names would actually be names of datasets.