概要
Calculates the geometric position coordinates for points, lines, and polygons.
使用法
Existing values in the specified coordinates field are overwritten every time the tool is run.
GFID cannot be used as input field.
The length of the text field you choose must coincide with the number of characters in the coordinate string. If it does not, the specified text field is not populated with the coordinate values.
The Coordinate Scale parameter (coord_scale for Python) is not applicable for the DMS21, MGRS, USNG, or UTM formats. This is due to the specification for these types of coordinates.
If the Round Coordinates check box is checked (coord_rounding parameter set to ROUND), additional rounding will be applied to the coordinate value before it populates the specified field.
If rounding occurs on UTM-based coordinates, it is done to the nearest whole number.
構文
arcpy.defense.CalculateCoordinates(in_features, field, coord_format, {coord_rounding}, {coord_scale}, {coord_accuracy})
パラメーター | 説明 | データ タイプ |
in_features | The feature layer for which you want to calculate coordinate values. | Feature Layer |
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 | The format of the calculated coordinate values.
| String |
coord_rounding (オプション) | Indicates whether the coordinate value is rounded or truncated based on the value specified in the coord_scale parameter.
| Boolean |
coord_scale (オプション) | 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 (オプション) | Determines the precision of the UTM coordinate.
| String |
コードのサンプル
CalculateCoordinates example (stand-alone 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: CalculateCoordinates.py
# Description: Calculates coordinate values for the AerofacP layer
# Requirements: ArcGIS Defense Mapping solution
# Import arcpy module
import arcpy
# Check out a DefenseMapping extension license
arcpy.CheckOutExtension("defense")
# Local variables
inField = "Coordinate"
inFeatures = r"C:/Data/defense.gdb/VMap2TLM/AerofacP"
coordFormat = "DMS21"
coordRounding = "true"
# coord_scale and coord_accuracy are ignored when coordFormat = "DMS21"
coordScale = "#"
coordAccuracy = "#"
# Execute Calculate Coordinates function
arcpy.CalculateCoordinates_defense(inFeatures, inField, coordFormat, coordRounding, coordScale, coordAccuracy)
# Check in the Defense Mapping extension
arcpy.CheckInExtension("defense")
環境
ライセンス情報
- Basic: いいえ
- Standard: 次のものが必要 Defense Mapping
- Advanced: 次のものが必要 Defense Mapping