Project (Data Management)

License Level:BasicStandardAdvanced

Summary

Projects spatial data from one coordinate system to another.

Usage

Syntax

Project_management (in_dataset, out_dataset, out_coor_system, {transform_method}, {in_coor_system})
ParameterExplanationData Type
in_dataset

The feature class, feature layer, or feature dataset to be projected.

Feature Layer; Feature Dataset
out_dataset

The output dataset to which the results will be written.

Geodataset
out_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
transform_method
(Optional)

This method can be used for converting data between two geographic coordinate systems or datums. This optional parameter may be required if the input and output coordinate systems have different datum.

TipTip:

Transformations are bi-directional. For example, if converting data from WGS 1984 to NAD 1927, you can pick a transformation called NAD_1927_to_WGS_1984_3, and the tool will apply it correctly.

String
in_coor_system
(Optional)

The coordinate system of the input feature class or dataset. This parameter becomes enabled when the input has an Unknown, or unspecified, coordinate system. This allows you to specify the data's coordinate system without having to modify the input data (which may not be possible if the input is in read-only format).

Coordinate System

Code Sample

Project example 1 (Python window)

The following Python window script demonstrates how to use the Project function in immediate mode.

import arcpy

input_features = "C:/data/input/projections.gdb/wells"
output_features_class = "C:/data/output/wells_UTM11N.shp"

install_dir = arcpy.GetInstallInfo()['InstallDir']
out_coordinate_system = os.path.join(install_dir, r"Coordinate Systems/Projected Coordinate Systems/UTM/NAD 1983/NAD 1983 UTM Zone 11N.prj")

arcpy.Project_management(input_features, output_features_class, out_coordinate_system)
Project example 2 (stand-alone script)

The following stand-alone script demonstrates how to use Project in a stand-alone script.

# Name: Project_Example2.py

# Description: Project all feature classes in a geodatabase
# Requirements: os module

# Import system modules
import arcpy
import os

# Set environment settings
arcpy.env.workspace = "C:/data/Redlands.gdb"
arcpy.env.overwriteOutput = True

# Set local variables
outWorkspace = "C:/data/Redlands_utm11.gdb"

try:
    # Use ListFeatureClasses to generate a list of inputs 
    for infc in arcpy.ListFeatureClasses():
    
        # Determine if the input has a defined coordinate system, can't project it if it does not
        dsc = arcpy.Describe(infc)
    
        if dsc.spatialReference.Name == "Unknown":
            print ('skipped this fc due to undefined coordinate system: ' + infc)
        else:
            # Determine the new output feature class path and name
            outfc = os.path.join(outWorkspace, infc)
            
            # Set output coordinate system
            outCS = arcpy.SpatialReference('NAD 1983 UTM Zone 11N')
            
            # run project tool
            arcpy.Project_management(infc, outfc, outCS)
            
            # check messages
            print(arcpy.GetMessages())
            
except arcpy.ExecuteError:
    print(arcpy.GetMessages(2))
    
except Exception as ex:
    print(ex.args[0])

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: Yes
ArcGIS for Desktop Standard: Yes
ArcGIS for Desktop Advanced: Yes
11/18/2013