3

How to Create multiple Feature Datasets from a table/list. I can create a single feature dataset in a geodatabase with this Python code.

import arcpy
from arcpy import env

env.workspace = "I:/python/MultipleFD2GDB"
arcpy.CreateFileGDB_management("I:/python/MultipleFD2GDB", "HabitatAnalysis.gdb")
arcpy.CreateFeatureDataset_management("I:/python/MultipleFD2GDB/HabitatAnalysis.gdb", "Cultural_Resources", "I:/python/MultipleFD2GDB/2229.prj")

These are the list of Feature dataset I want in the geodatabase. "EMI_EMF", "Cultural_Resources", "Parcels", "Hazardous_Materials", "Footprint", "Checkpoint_B", "Wetlands", "Botany", "Land_Use", "Buffers", "Air_Quality", "Transportation", "Topography", "Aesthetics_VisualQuality", "Socioeconomics", "Noise_and_Vibe", "Safety_and_Security", "Alignments", "Annotation", "Mapbook_Grids", "Biology", "Geology", "Public_Utilities", "Agriculture", "Public_Lands", "Hydrology", "BSA", "Overview", "Cumulative", "Alternatives_Analysis", "Permission_to_Enter", "Public_Affairs", "Right_of_Way", "Wells", "Wind_Energy"

4

Yes - you need to use a Python list and process it using a for loop:

import arcpy 

arcpy.CreateFileGDB_management("I:/python/MultipleFD2GDB", "HabitatAnalysis.gdb")

fdList = ["EMI_EMF", "Cultural_Resources", "Parcels", "Hazardous_Materials", "Footprint", "Checkpoint_B", "Wetlands", "Botany", "Land_Use", "Buffers", "Air_Quality", "Transportation", "Topography", "Aesthetics_VisualQuality", "Socioeconomics", "Noise_and_Vibe", "Safety_and_Security", "Alignments", "Annotation", "Mapbook_Grids", "Biology", "Geology", "Public_Utilities", "Agriculture", "Public_Lands", "Hydrology", "BSA", "Overview", "Cumulative", "Alternatives_Analysis", "Permission_to_Enter", "Public_Affairs", "Right_of_Way", "Wells", "Wind_Energy"]

for fd in fdList:
    arcpy.CreateFeatureDataset_management("I:/python/MultipleFD2GDB/HabitatAnalysis.gdb", fd, "I:/python/MultipleFD2GDB/2229.prj")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy