Define Projection (Data Management)
Summary
This tool overwrites the coordinate system information (map projection and datum) stored with a dataset. The only use for this tool is for datsets that have an unknown or incorrect coordinate system defined.
All geographic datasets have a coordinate system that is used throughout ArcGIS to display, measure, and transform geographic data. If the coordinate system for a dataset is unknown or incorrect, you can use this tool to specify the correct coordinate system. You must know the correct coordinate system of the dataset before using this tool.
Usage
This tool only updates the existing coordinate system information—it does not modify any geometry. If you want to transform the geometry to another coordinate system, use the Project tool.
The most common use for this tool is to assign a known coordinate system to a dataset with an unknown coordinate system (that is, the coordinate system is "Unknown" in the dataset properties). Another use is to assign the correct coordinate system for a dataset that has an incorrect coordinate system defined (for example, the coordinates are in UTM meters but the coordinate system is defined as geographic).
When a dataset with a known coordinate system is input to this tool, the tool will issue a warning but will execute successfully.
-
All feature classes in a geodatabase feature dataset will be in the same coordinate system. The coordinate system for a geodatabase dataset should be determined when it is created. Once it contains feature classes, its coordinate system cannot be changed.
Syntax
Parameter | Explanation | Data Type |
in_dataset |
Dataset or feature class whose projection is to be defined. | Feature Layer;Geodataset |
coor_system |
Valid values are a Spatial Reference object, a file with a .prj extension, or a string representation of a coordinate system. | Coordinate System |
Code Sample
The following Python Window script demonstrates how to use the DefineProjection function in immediate mode.
import arcpy import os infc = r"C:\data\citylim_unk.shp" prjfile = os.path.join(arcpy.GetInstallInfo()["InstallDir"], "Coordinate Systems/Projected Coordinate Systems/UTM/NAD 1983/NAD 1983 UTM Zone 11N.prj") arcpy.DefineProjection_management(infc, prjfile)
The following stand-alone script uses the DefineProjection function to record coordinate system information for the input dataset.
# Name: DefineProjection.py # Description: Records the coordinate system information for the specified input dataset or feature class # import system modules import arcpy # set workspace environment arcpy.env.workspace = "C:/data" # set local variables inDataset = "forest.shp" coordinateSystem = "GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]" arcpy.DefineProjection_management(inDataset, coordinateSystem)