Posts

Showing posts from August, 2012

How to batch define projections with arcpy ArcGIS 10

ArcGIS 9.3 had a nice batch define tool in the toolbox that was removed in ArcGIS 10.  ArcGIS 10 has python 2.6.3 for the geoprocessing and well all kinds of fun stuff can be done with arcpy. So how to batch define the projection for a folder full of shapefiles is the problem at hand. For those who can't wait I posted the code here first and the explanation comes after. Python Code # Name: DefineProjection.py # Description: Records the coordinate system information for the specified input dataset or feature class # Author: ESRI # import system modules import arcpy from arcpy import env import os # set workspace environment where the shapefiles are located env.workspace = "C:\\BaseFolderName\\FolderOfShapefiles" # creates a list of feature classes or shapefiles in the current workspace fcs = arcpy.ListFeatureClasses('*') # set local variables try: for file in fcs: inData = file coordinateSystem = "PROJCS[\"MGI_Austria_GK_