Batch Project (Data Management)

License Level:BasicStandardAdvanced

Summary

Changes the coordinate system of a set of input feature classes or feature datasets to a common coordinate system. To change the coordinate system of a single feature class or dataset use the Project tool.

Usage

Syntax

BatchProject_management (Input_Feature_Class_or_Dataset, Output_Workspace, {Output_Coordinate_System}, {Template_dataset}, {Transformation})
ParameterExplanationData Type
Input_Feature_Class_or_Dataset
[Input_Feature_Class_or_Dataset,...]

The input feature classes or feature datasets whose coordinates are to be converted.

Geodataset
Output_Workspace

The location of each new output feature class or feature dataset.

Feature Dataset; Workspace
Output_Coordinate_System
(Optional)

The coordinate system to be used to project the inputs.

Valid values are a Spatial Reference object, a file with a .prj extension, or a string representation of a coordinate system.

Coordinate System
Template_dataset
(Optional)

The feature class or the feature dataset used to specify the output coordinate system used for projection.

Geodataset
Transformation
(Optional)

Name of the geographic transformation to be applied to convert data between two geographic coordinate systems (datums).

String

Code Sample

BatchProject example 1 (Python window)

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

import arcpy
arcpy.env.workspace = "C:/data/input/batchproject"

arcpy.BatchProject_management(["citylim.shp", "flood.shp", "faultzn.shp"], "C:/data/output/batchproject", "", "C:/data/usa.gdb/templatefc")
BatchProject example 2 (stand-alone Python script

The following Python script demonstrate how to use the BatchProject function in a stand-alone script.

# Name: BatchProject.py
# Description: Changes coordinate systems of several datasets in a batch.

import arcpy
from arcpy import env

# Set workspace environment
env.workspace = "C:/data/wgs1972.gdb"

# Input feature classes
input_features = ["cities", "counties", "blocks", "crime"]

# Output workspace
out_workspace = "C:/data/output.gdb"

# Output coordinate system - leave it empty
out_cs = ''

# Template dataset - it has GCS_WGS_1984 coordinate system
template = "C:/data/wgs1984.gdb/stateparks"

# Geographic transformation - 
transformation = "WGS_1972_To_WGS_1984_1"

try:
   res = arcpy.BatchProject(input_features, out_workspace, out_cs, template, transformation)
   if res.maxSeverity == 0:
      print "projection of all datasets successful"
   else:
      print "failed to project one or more datasets"
except:
   print res.getMessages()

Environments

Related Topics

Licensing Information

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