Bulk Define Projection in ArcGIS

Occasionally I have a workspace (usually a file geodatabase) where I need to define the projection for all of the feature classes in the workspace. Here’s a simple script to do this.

[raw]

import arcpy
#Enter the full path to a workspace
ws = r"C:\path\to\myFGDB.gdb"
#Enter a WKID for a coordinate system
wkid=32100
arcpy.env.workspace = ws
sr = arcpy.SpatialReference(wkid)
fcs = arcpy.ListFeatureClasses()
for fc in fcs:
    arcpy.DefineProjection_management(fc, sr)

[/raw]

Share:

Share on facebook
Facebook
Share on twitter
Twitter
Share on pinterest
Pinterest
Share on linkedin
LinkedIn

Related Posts