Defining Projections for Multiple Shapefiles in ArcMap – How to Guide

arcgis-10.0arcpycoordinate system

I have over 100 shape files that don't have .prj file and thus when I bring them into ArcMap 10 they show the coordinate system as unknown. I know all of the shape files coordinate system is GCS WGS 1984. I also know I can use the Define Projection GP tool to individually assign the coordinate system to each file but that will take forever.

I was hoping there was a GP tool to batch define these but I don't see one. Next I was thinking maybe I could use python to do this so I looked in the help menu and found a script but it gives me an error.

Here is the python code I tried (this is for a single shp file so I would still have the pain of typing the name for each file:

import arcpy
infc = r"C:\Documents and Settings\User\My Documents\ArcGIS\shpfiles\Site_2.shp"
prjfile = r"<install directory>\Coordinate Systems\Geographic Coordinate Systems\World\WGS 1984.prj"
arcpy.DefineProjection_management(infc, prjfile)

Best Answer

I think you guys are overthinking this one...

  1. Right-click on the "Define Projection" tool in toolbox,
  2. select "Batch",
  3. drag-and-drop your layers into the "Input Dataset" column,
  4. right-click in the first "Coordinate System" box to fill out the correct projection,
  5. then right-click on the projection you just selected and choose "Fill" which will fill out all of the rest of the projections for you.
  6. Hit "OK" and you are done.

alt text

Related Question