[GIS] Trying to change the coordinate system of feature classes

arcpycoordinate system

I'm trying to change the coordinate system of a batch of feature classes to 'Geodetic datum GDA94(code=4283) using Define Projection. I receive no python error message and no change to the coordinate system, just lists returned from ListFeatureClasses and ListWorkspaces. My code is below. Can someone suggest why Define Projection isn't converting the data it receives?

import arcpy
from arcpy import env
import os

#set path where the shapefiles are located
arcpy.env.workspace = "Z:/temp"


#returns @string list of GDB folders
workspaces = arcpy.ListWorkspaces('*', "FileGDB")
for item in workspaces:
    print item
    env.workspace = item


#returns @string list of feature classes
    fcs = arcpy.ListFeatureClasses()
    for file in fcs:
        print '\t', file

 # set local variables
        for file in fcs:
          inData = file
          coordinateSystem = arcpy.SpatialReference(4283)
          arcpy.DefineProjection_management(inData, coordinateSystem)

Best Answer

You appear to be confusing two tools:

  • Define Projection which simply assigns a coordinate system to a dataset without changing that data i.e. the X,Y values all stay the same
  • Project which projects data in one coordinate system into another i.e. the X,Y values undergo complex calculations (projection) to change them into values that match the new desired coordinate system

I suspect that it is the Project tool which you should be using here.