AnsweredAssumed Answered

Arcpy.da.Walk(workspace, datatype = "FeatureDataset")

Question asked by Playa on Aug 25, 2014
Latest reply on Aug 26, 2014 by jamesfreddyc

I'm currently building a python script that will iterate through Feature Datasets within a File Geodatabase. I then want to create a  new set of Feature Datasets based on the current Feature Datasets but with a different spatial reference. I want to select the Feature Classes within the original Feature Dataset and project and save them into the newly created Feature Datasets.


I want to use arcpy.da.walk to firstly get a list of the Feature Datasets in order to create the new Feature Datasets, but for some unknown reason even if I set the datatype to "FeatureDataset" nothing is returned. Any assistance to resolve the following will truly be appreciated.


Also if someone can guide me in how to only retrieve the Feature Classes in the Feature Dataset and not directly within the File Geodatabase and how then to save the the reprojected Feature Classes into the newly generated Feature Datasets.


Created on Aug 25, 2014

@author: PeterW

# Import system modules
import arcpy
import os

# Set current workspace
workspace = r'E:\Projects\Projects14\H103342\test2.gdb'
arcpy.env.workspace = workspace

# Set environment settings
arcpy.env.overwriteOutput = True

# Create list of Feature Classes in each Feature Dataset
fcs = []

# Iterate through each Feature Dataset within the File Geodatabase
for dirpath, dirnames, filenames in arcpy.da.Walk(workspace, datatype = "FeatureDataset"):
    for filename in filenames:
        print filename