Let's say I would like to create several feature datasets in a single geodatabase with a known FD name.
This is how the GDB structure will going to be ....
Here is the Python (ArcPy) code..
import arcpy
from arcpy import env
env.workspace = "I:/python/MultipleFD2GDB"
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")
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Let's say I would like to create several feature datasets from a list present in a separate Geodatabase.
import arcpy
from arcpy import env
env.workspace = "I:/python/MultipleFD2GDB"
arcpy.CreateFileGDB_management("I:/python/MultipleFD2GDB", "HabitatAnalysis.gdb")
#create a search cursor
rows = arcpy.SearchCursor(r'I:\python\MultipleFD2GDB\HabitatAnalysis1.gdb\fds_name')
#loop through the rows in the cursor to get the name from the field and then create the fds
for row in rows:
outfds = row.field_fds_name
arcpy.CreateFeatureDataset_management("I:/python/MultipleFD2GDB/HabitatAnalysis.gdb", outfds, "I:/python/MultipleFD2GDB/2229.prj")
No comments:
Post a Comment