Calculate Coordinates (Defense Mapping)

Summary

Calculates the geometric position coordinates for points, lines, and polygons.

Usage

Syntax

CalculateCoordinates_defense (in_features, in_field, {coord_format}, {coord_rounding}, {coord_scale}, {coord_accuracy})
ParameterExplanationData Type
in_features

The feature layer for which you want to calculate coordinate values.

Feature Layer
in_field

The field in the input_features that is going to be updated with the coordinate values. This must be a string field. The GFID field is excluded for this tool.

Field
coord_format
(Optional)

The format of the calculated coordinate values.

  • DD_LATThe coordinates are calculated in the decimal degrees format for latitude. This is the default. For this format, the text field must be at least two characters long, plus the value specified in the coord_scale parameter.
  • DD_LONGThe coordinates are calculated in the decimal degrees format for longitude. For this format, the text field must be at least three characters long, plus the value specified in the coord_scale parameter.
  • DMS_LATThe coordinates are calculated in the degrees, minutes, and seconds format for latitude. For this format, the text field must be at least 12 characters long, plus the value specified in the coord_scale parameter.
  • DMS_LONGThe coordinates are calculated in the degrees, minutes, and seconds format for longitude. For this format, the text field must be at least 13 characters long, plus the value specified in the coord_scale parameter.
  • DMS21The coordinates are calculated based on the degrees, minutes, and seconds format, resulting in a 21-character concatenated string representing both latitude and longitude. Example: 34° 02' 29.325'' N 117° 10' 17.125'' W = 340229325N1171017125W. For this format, the text field must be at least 21 characters long.
  • MGRSThe coordinates are calculated in the Military Grid Reference System (MGRS) format. For this format, the text field must be at least 15 characters long.
  • USNGThe coordinates are calculated in the U.S. National Grid format. For this format, the text field must be at least 18 characters long.
  • UTMThe coordinates are calculated in the Universal Transverse Mercator format. For this format, the text field must be at least 13 characters long.
String
coord_rounding
(Optional)

Indicates whether the coordinate value is rounded or truncated based on the value specified in the coord_scale parameter.

  • ROUNDThe coordinate value is rounded up or down based on the value specified in the coord_scale parameter.
  • TRUNCATEThe coordinate value is shortened based on the value specified in the coord_scale parameter. This is the default.
Boolean
coord_scale
(Optional)

The number of digits allowed after the decimal point. The default value is 3. Used in conjunction with the coord_rounding parameter, it determines the length of the coordinate value.

Long
coord_accuracy
(Optional)

Determines the precision of the UTM coordinate.

  • FULL_VALUEPopulates the field using all 13 digits from the UTM coordinate value
  • TEN_DIGITPopulates the field using 10-meter precision
  • EIGHT_DIGITPopulates the field using 100-meter precision
  • SIX_DIGITPopulates the field using 1,000-meter precision
  • FOUR_DIGIT Populates the field using 10,000-meter precision
NoteNote:

This parameter is only available if you choose UTM in the Coordinate Format (coord_format) parameter.

String

Code Sample

CalculateCoordinates example (stand-alone Python script)

In this example, the coordinates are calculated and rounded in the DMS21 format for the AerofacP feature layer and stored in the Coordinate field.

# Name: CalculateDefaultValues.py
# Description: Calculates coordinate values for the AerofacP layer 
# Date: June 2010

# Import arcpy module
import arcpy

# Check out a DefenseMapping extension license
arcpy.CheckOutExtension("defense")

# Import the Defense Mapping toolbox - you may have to alter this path
arcpy.ImportToolbox("C:/Program Files/ArcGIS/Desktop10.0/ArcToolbox/Toolboxes/Defense Mapping Tools.tbx")

# Local variables
in_field = "Coordinate"
in_features = "C:/Data/10.0/Defense/VMap2TLM_931.mdb/VMap2TLM/AerofacP"
coord_format = "DMS21"
coord_rounding = "true"
# coord_scale and coord_accuracy are ignored when coord_format = "DMS21"
coord_scale = "#"
coord_accuracy = "#"

# Execute Calculate Coordinates function
arcpy.CalculateCoordinates_defense(in_features, in_field, coord_format, coord_rounding, coord_scale, coord_accuracy)

# Check in the Defense Mapping extension
arcpy.CheckInExtension("defense")

Environments

This tool does not use any geoprocessing environments

Related Topics

Licensing Information

ArcView: No
ArcEditor: Requires Defense Mapping
ArcInfo: Requires Defense Mapping

12/20/2012