Summary
Converts source coordinates in a table to multiple coordinate formats.
The tool uses an input table with coordinates and outputs a new table with fields for the following coordinate formats: Decimal Degrees, Degrees and Decimal Minutes, Degrees Minutes and Seconds, Global Area Reference System, World Geographic Reference System, Universal Transverse Mercator, United States National Grid, and Military Grid Reference System.
Usage
The output table maintains the original fields of the input table and adds text fields for the converted notations, including the following:
- DDLat—Decimal Degrees latitude field
- DDLon—Decimal Degrees longitude field
- DDMLat—Degree and Decimal Minutes latitude field
- DDMLon—Degree and Decimal Minutes longitude field
- DMSLat—Degrees, Minutes, and Seconds latitude field
- DMSLon—Degrees, Minutes, and Seconds longitude field
- UTM_BANDS—Universal Transverse Mercator Bands
- MGRS—Military Grid Reference System
- USNG—United States National Grid
- GARS—Global Area Reference System
- GEOREF—World Geographic Reference System
Syntax
arcpy.defense.GenerateCoordinateNotations(in_table, out_table, x_or_lon_field, in_coordinate_format, {y_or_lat_field}, {coordinate_system})
Parameter | Explanation | Data Type |
in_table | The table containing the source coordinates. | Table View |
out_table | The output table containing the converted coordinates. | Table |
x_or_lon_field | The field in the input table containing the x or longitude coordinates. | Field |
in_coordinate_format | Specifies the format of the input table coordinates.
| String |
y_or_lat_field (Optional) | The field in the input table containing the y or latitude coordinates. The y_or_lat_field parameter is used when the in_coordinate_format parameter is set to DD_2, DDM_2, or DMS_2. | Field |
coordinate_system (Optional) | The spatial reference of the coordinates in the output table. The default is GCS_WGS_1984. | Spatial Reference |
Code sample
The following Python window script demonstrates how to use the GenerateCoordinateNotations function.
import arcpy
arcpy.env.workspace = r"C:/Data.gdb"
arcpy.GenerateCoordinateNotations_defense(r"C:/CSV/TableToPoint.csv",
"TableWithMGRS", "x", "DD_2", "y")
The following example uses the GenerateCoordinateNotations function in a sample workflow script.
# Description: Add additional coordinate fields to data and then create points
# from output table.
# Import system modules
import arcpy
# Set environment settings
arcpy.env.workspace = r"C:/Data.gdb"
arcpy.env.overwriteOutput = True
# Add additional coordinate formats
in_coords = r"C:/CSV/TableToPoint.csv"
out_table = "TableWithMGRS"
arcpy.GenerateCoordinateNotations_defense(in_coords, out_table, "x", "DD_2", "y")
# Create points
result_point = "Output_Point"
arcpy.CoordinateTableToPoint_defense(out_table, result_point, "MGRS", "MGRS")
Environments
Licensing information
- Basic: Yes
- Standard: Yes
- Advanced: Yes