Summary
Calculates the UTM zone of each feature based on the center point and stores this spatial reference string in a specified field. This field can be used with Data Driven Pages to update the spatial reference to the correct UTM zone for each map.
Usage
Input features can be points, lines, or polygons.
Geometries located at extreme latitudes, near either the north or south pole, may not be appropriate for UTM zone calculation. You will receive a warning when a UTM zone cannot be calculated for a particular feature.
The datum for the calculated UTM coordinate system string is taken from the datum of the active data frame's coordinate system. If the datum of the feature's data source is different than that of the data frame, you will receive a warning. If a UTM zone is calculated, however, the result may not be accurate. The tool does not perform any geotransformations. For best results, the datum of your input features should be the same as the datum of the data frame.
The UTM Zone Field parameter, which contains the UTM spatial reference string, should have a length of 600 characters or more. Spatial reference strings vary in length but are usually quite long, and you need to ensure that the field has enough space. The tool will issue a warning if the spatial reference string has been truncated because the field length is not long enough. If you receive this warning, some of the spatial reference strings generated may have been truncated, making them useless. If you receive this warning, delete your results, create a field of sufficient length (more than 600 characters), and rerun the tool.
Use geodatabase feature classes rather than shapefiles. In most cases, field size limitation makes it likely that spatial reference strings will be truncated if you run this tool on a shapefile.
Syntax
arcpy.cartography.CalculateUTMZone(in_features, in_field)
Parameter | Explanation | Data Type |
in_features | The input feature layer. | Feature Layer |
in_field | The string field that stores the spatial reference string for the coordinate system. The field should have sufficient length (more than 600 characters) to hold the spatial reference string. | Field |
Derived Output
Name | Explanation | Data Type |
out_features | The updated feature class with the calculated spatial reference strings. | Feature Layer |
Code sample
CalculateUTMZone example (Python window)
The following example calculates a custom UTM zone for a set of features.
import arcpy
arcpy.env.workspace = "C:\Data\ProjectData.gdb"
arcpy.CalculateUTMZone_cartography("US_Counties", "UTM_Zone")
CalculateUTMZone example (stand-alone script)
The following example calculates a custom UTM zone for a set of features.
# Name: calculateutmzone_example.py
# Description: Calculates a custom UTM zone for a set of features
# Author: ESRI
# Import system modules
import arcpy
from arcpy import env
# Set environment settings
arcpy.env.workspace = "C:\Data\ProjectData.gdb"
# Set local variables
inFeatures = "US_states"
utmField = "UTM_zone"
# Execute CalculateUTMZone
arcpy.CalculateUTMZone_cartography(inFeatures, utmField)
Environments
Licensing information
- Basic: Yes
- Standard: Yes
- Advanced: Yes