Convert Coordinate Notation (Data Management)

Summary

Converts coordinate notations contained in one or two fields from one notation format to another.

Learn more about supported notation formats

Usage

  • The coordinate system of the values stored in the X Field (Longitude) and Y Field (Latitude) values is specified with the Input Coordinate System parameter. The default is GCS_WGS_1984 unless the input table is a feature class, in which case the default is the coordinate system of the input features.

  • The following formats are supported:

    • Decimal degrees (DD)
    • Degrees decimal minutes (DDM)
    • Degrees-minutes-seconds (DMS)
    • Global Area Reference System (GARS)
    • World Geographic Reference System (GEOREF and GEOREF 16)
    • Universal Transverse Mercator (UTM)
    • United States National Grid (USNG and USNG 16)
    • Military Grid Reference System (MGRS and MGRS 16)

  • For the Input Coordinate Format parameter options DD 1, DDM 1, and DMS 1, the latitude and longitude values must represent a location that is concatenated together and stored in a single field.

    For the DD 2, DDM 2, and DMS 2 options, the latitude and longitude values are represented by two separate fields.

    For the DD numeric option, the latitude and longitude values are stored in two separate fields of type double.

    For the Gars, Georef, Georef 16, UTM zones, UTM bands, USNG, USNG 16, MGRS and MGRS 16 options, the values are single-string coordinate formats, meaning only one field contains the coordinate.

  • For the Input Coordinate Format and Output Coordinate Format parameters, the MGRS 16 (example: 11SLT7858811533670379), USNG 16, and Georef 16 options have higher precision (16 digits) than the equivalent MGRS (example: 11SLT78588115), USNG, and Georef options (8 digits).

  • All fields from the input table, including the OID field and the input format fields, are transferred to the output point feature class. The OID field values can be used to differentiate valid notations that are converted if the Exclude records with invalid notation parameter is checked.

    Output field names are matched to the name of the output coordinate notation. For example, if the output format is MGRS, the new output field name will be MGRS.

    If a field with the same name as the input field already exists in the output, the name of the copied field will be appended with a unique number.

  • Uncheck the Exclude records with invalid notation parameter to retain information regarding all input records. The Check Geometry tool can be used to identify records with invalid notations.

    If there are records with invalid notations, the tool messages will include the path of the log file that contains IDs of all invalid records.

  • The Add XY Coordinates tool can be used to add two fields—POINT_X and POINT_Y—to the output point feature class. These fields contain the coordinates of a point in the unit of the coordinate system of the feature class.

Parameters

LabelExplanationData Type
Input Table

The input table or text file. Point features are also valid.

Table View
Output Feature Class

The output point feature class. The attribute table will contain all fields of the input table along with the fields containing converted values in the output format.

Feature Class
X Field (Longitude)

A field from the input table containing the longitude value.

For the Input Coordinate Format parameter's DD 2, DD numeric, DDM 2, and DMS 2 options, this is the longitude field.

For the DD 1, DDM 1, and DMS 1 options, this field contains both latitude and longitude values in a single string.

For the Gars, Georef, Georef 16, UTM zones, UTM bands, USNG, USNG 16, MGRS, and MGRS 16 options, this field contains an alphanumeric notation in a single text field.

Field
Y Field (Latitude)

A field from the input table containing the latitude value.

For the Input Coordinate Format parameter's DD 2, DD numeric, DDM 2, and DMS 2 options, this is the latitude field.

This parameter is inactive when one of the single-string formats is chosen.

Field
Input Coordinate Format

Specifies the coordinate format of the input fields.

  • DD 1 —Both longitude and latitude values are in a single field. Two values are separated by a space, a comma, or a slash.
  • DD 2 —Longitude and latitude values are in two separate fields.This is the default.
  • DDM 1 —Both longitude and latitude values are in a single field. Two values are separated by a space, a comma, or a slash.
  • DDM 2 — Longitude and latitude values are in two separate fields.
  • DMS 1 —Both longitude and latitude values are in a single field. Two values are separated by a space, a comma, or a slash.
  • DMS 2 —Longitude and latitude values are in two separate fields.
  • Gars —Global Area Reference System. Based on latitude and longitude, it divides and subdivides the world into cells.
  • Georef —World Geographic Reference System. A grid-based system that divides the world into 15-degree quadrangles and then subdivides into smaller quadrangles.
  • Georef 16 —World Geographic Reference System in 16-digit precision.
  • UTM zones —The letter N or S after the UTM zone number designates only North or South hemisphere.
  • UTM bands —The letter after the UTM zone number designates one of the 20 latitude bands. N or S does not designate a hemisphere.
  • USNG —United States National Grid. Almost exactly the same as MGRS but uses North American Datum 1983 (NAD83) as its datum.
  • USNG 16 —United States National Grid in 16-digit higher precision.
  • MGRS —Military Grid Reference System. Follows the UTM coordinates and divides the world into 6-degree longitude and 20 latitude bands, but MGRS then further subdivides the grid zones into smaller 100,000-meter grids. These 100,000-meter grids are then divided into 10,000-meter, 1,000-meter, 100-meter, 10-meter, and 1-meter grids.
  • MGRS 16 —Military Grid Reference System in 16-digit precision.
  • Shape —Only available when a point feature layer is selected as input. The coordinates of each point are used to define the output format.
String
Output Coordinate Format

Specifies the coordinate format to which the input notations will be converted.

  • DD 1 —Both longitude and latitude values are in a single field. Two values are separated by a space, a comma, or a slash.
  • DD 2 —Longitude and latitude values are in two separate fields.
  • DD numeric —Longitude and latitude values are in two separate fields of type Double. Values in the West and South are denoted by a minus sign.
  • DDM 1 —Both longitude and latitude values are in a single field. Two values are separated by a space, a comma, or a slash.
  • DDM 2 — Longitude and latitude values are in two separate fields.
  • DMS 1 —Both longitude and latitude values are in a single field. Two values are separated by a space, a comma, or a slash.
  • DMS 2 —Longitude and latitude values are in two separate fields.
  • Gars —Global Area Reference System. Based on latitude and longitude, it divides and subdivides the world into cells.
  • Georef —World Geographic Reference System. A grid-based system that divides the world into 15-degree quadrangles and then subdivides into smaller quadrangles.
  • Georef 16 —World Geographic Reference System in 16-digit precision.
  • UTM zones —The letter N or S after the UTM zone number designates only North or South hemisphere.
  • UTM bands —The letter after the UTM zone number designates one of the 20 latitude bands. N or S does not designate a hemisphere.
  • USNG —United States National Grid. Almost exactly the same as MGRS but uses North American Datum 1983 (NAD83) as its datum.
  • USNG 16 —United States National Grid in 16-digit higher precision.
  • MGRS —Military Grid Reference System. Follows the UTM coordinates and divides the world into 6-degree longitude and 20 latitude bands, but MGRS then further subdivides the grid zones into smaller 100,000-meter grids. These 100,000-meter grids are then divided into 10,000-meter, 1,000-meter, 100-meter, 10-meter, and 1-meter grids.
  • MGRS 16 —Military Grid Reference System in 16-digit precision.
String
ID
(Optional)

This parameter is no longer used as all fields are transferred to output table.

Field
Output Coordinate System
(Optional)

The spatial reference of the output feature class. The default is GCS_WGS_1984.

The tool projects the output to the spatial reference specified. If the input and output coordinate systems are in a different datum, a default transformation will be used based on the coordinate systems of the input and the output and the extent of the data.

Spatial Reference
Input Coordinate System
(Optional)

The spatial reference of the input data. If the input spatial reference cannot be obtained from the input table, a default of GCS_WGS_1984 will be used.

Coordinate System
Exclude records with invalid notation
(Optional)

Specifies whether records with invalid notation will be excluded.

  • Unchecked—Invalid records will be excluded, and only valid records will be converted to points in the output. This is the default.
  • Checked—Valid records will be converted to points in the output and invalid records will be included as null geometry.

Boolean

arcpy.management.ConvertCoordinateNotation(in_table, out_featureclass, x_field, y_field, input_coordinate_format, output_coordinate_format, {id_field}, {spatial_reference}, {in_coor_system}, {exclude_invalid_records})
NameExplanationData Type
in_table

The input table or text file. Point features are also valid.

Table View
out_featureclass

The output point feature class. The attribute table will contain all fields of the input table along with the fields containing converted values in the output format.

Feature Class
x_field

A field from the input table containing the longitude value.

For the input_coordinate_format parameter's DD_2, DD_NUMERIC, DDM_2, and DMS_2 options, this is the longitude field.

For the DD_1, DDM_1, and DMS_1 options, this field contains both latitude and longitude values in a single string.

For the GARS, GEOREF, GEOREF16, UTM_ZONES, UTM_BANDS, USNG, USNG16, MGRS and MGRS16, this field contains an alphanumeric system of notation in a single text field.

Field
y_field

A field from the input table containing the latitude value.

For the input_coordinate_format parameter's DD_2, DD_NUMERIC, DDM_2, and DMS_2, this is the longitude field.

This parameter is ignored when one of the single-string formats is chosen.

Field
input_coordinate_format

Specifies the coordinate format of the input fields.

  • DD_1Both longitude and latitude values are in a single field. Two values are separated by a space, a comma, or a slash.
  • DD_2Longitude and latitude values are in two separate fields.This is the default.
  • DDM_1Both longitude and latitude values are in a single field. Two values are separated by a space, a comma, or a slash.
  • DDM_2 Longitude and latitude values are in two separate fields.
  • DMS_1Both longitude and latitude values are in a single field. Two values are separated by a space, a comma, or a slash.
  • DMS_2Longitude and latitude values are in two separate fields.
  • GARSGlobal Area Reference System. Based on latitude and longitude, it divides and subdivides the world into cells.
  • GEOREFWorld Geographic Reference System. A grid-based system that divides the world into 15-degree quadrangles and then subdivides into smaller quadrangles.
  • GEOREF16World Geographic Reference System in 16-digit precision.
  • UTM_ZONESThe letter N or S after the UTM zone number designates only North or South hemisphere.
  • UTM_BANDSThe letter after the UTM zone number designates one of the 20 latitude bands. N or S does not designate a hemisphere.
  • USNGUnited States National Grid. Almost exactly the same as MGRS but uses North American Datum 1983 (NAD83) as its datum.
  • USNG16United States National Grid in 16-digit higher precision.
  • MGRSMilitary Grid Reference System. Follows the UTM coordinates and divides the world into 6-degree longitude and 20 latitude bands, but MGRS then further subdivides the grid zones into smaller 100,000-meter grids. These 100,000-meter grids are then divided into 10,000-meter, 1,000-meter, 100-meter, 10-meter, and 1-meter grids.
  • MGRS16Military Grid Reference System in 16-digit precision.
  • SHAPEOnly available when a point feature layer is selected as input. The coordinates of each point are used to define the output format.

DD, DDM, DMS, and UTM are also valid keywords; they can be used just by typing in (on dialog) or passing the value in scripting. However, keywords with underscore and a qualifier tell more about the field values.

String
output_coordinate_format

Specifies the coordinate format to which the input notations will be converted.

  • DD_1Both longitude and latitude values are in a single field. Two values are separated by a space, a comma, or a slash.
  • DD_2Longitude and latitude values are in two separate fields.
  • DD_NUMERICLongitude and latitude values are in two separate fields of type Double. Values in the West and South are denoted by a minus sign.
  • DDM_1Both longitude and latitude values are in a single field. Two values are separated by a space, a comma, or a slash.
  • DDM_2 Longitude and latitude values are in two separate fields.
  • DMS_1Both longitude and latitude values are in a single field. Two values are separated by a space, a comma, or a slash.
  • DMS_2Longitude and latitude values are in two separate fields.
  • GARSGlobal Area Reference System. Based on latitude and longitude, it divides and subdivides the world into cells.
  • GEOREFWorld Geographic Reference System. A grid-based system that divides the world into 15-degree quadrangles and then subdivides into smaller quadrangles.
  • GEOREF16World Geographic Reference System in 16-digit precision.
  • UTM_ZONESThe letter N or S after the UTM zone number designates only North or South hemisphere.
  • UTM_BANDSThe letter after the UTM zone number designates one of the 20 latitude bands. N or S does not designate a hemisphere.
  • USNGUnited States National Grid. Almost exactly the same as MGRS but uses North American Datum 1983 (NAD83) as its datum.
  • USNG16United States National Grid in 16-digit higher precision.
  • MGRSMilitary Grid Reference System. Follows the UTM coordinates and divides the world into 6-degree longitude and 20 latitude bands, but MGRS then further subdivides the grid zones into smaller 100,000-meter grids. These 100,000-meter grids are then divided into 10,000-meter, 1,000-meter, 100-meter, 10-meter, and 1-meter grids.
  • MGRS16Military Grid Reference System in 16-digit precision.

DD, DDM, DMS, and UTM are also valid keywords; they can be used just by typing in (on dialog) or passing the value in scripting. However, keywords with underscore and a qualifier tell more about the field values.

String
id_field
(Optional)

This parameter is ignored as all fields are transferred to output table.

Field
spatial_reference
(Optional)

The spatial reference of the output feature class. The default is GCS_WGS_1984.

The tool projects the output to the spatial reference specified. If the input and output coordinate systems are in a different datum, a default transformation will be used based on the coordinate systems of the input and the output and the extent of the data.

Spatial Reference
in_coor_system
(Optional)

The spatial reference of the input data. If the input spatial reference cannot be obtained from the input table, a default of GCS_WGS_1984 will be used.

Coordinate System
exclude_invalid_records
(Optional)

Specifies whether to exclude records with invalid notation.

  • EXCLUDE_INVALIDInvalid records will be excluded and only valid records will be converted to points in the output. This is the default.
  • INCLUDE_INVALIDValid records will be converted to points in the output and invalid records will be included as null geometry.
Boolean

Code sample

ConvertCoordinateNotation example 1 (stand-alone script)

The following stand-alone script demonstrates how to use the ConvertCoordinateNotation function with one input format field.

# import arcpy module
import arcpy

# set locals variables
in_tab = r"c:\data\notation.gdb\loc_mgrs"
out_pts = r"c:\data\notation.gdb\loc_final"

# call Convert Coordinate Notation with MGRS as input field.
# leaving out spatial reference parameter will default to WGS 1984 
arcpy.ConvertCoordinateNotation_management(in_tab, out_pts, "m10d", "#", "MGRS", "DD_1")
ConvertCoordinateNotation example 2 (stand-alone script)

The following stand-alone script demonstrates how to use the ConvertCoordinateNotation function with two input format fields.

# imports
import arcpy

arcpy.env.workspace = r"c:\data\mtf.gdb"

# set parameter values
input_table = 'rit_up_DD'
output_points = 'ritLOC'
x_field = 'LON'
y_field = 'LAT'
input_format = 'DD_2'
output_format = 'GARS'
id_field = 'CITY_NAME'
spatial_ref = arcpy.SpatialReference('WGS 1984')

try:
    arcpy.ConvertCoordinateNotation_management(input_table, output_points, x_field, y_field, 
                                               input_format, output_format, id_field, spatial_ref)
    print(arcpy.GetMessages(0))

except arcpy.ExecuteError:
    print(arcpy.GetMessages(2))
    
except Exception as ex:
    print(ex.args[0])
ConvertCoordinateNotation example 3 (stand-alone script)

The following stand-alone script demonstrates how to use the ConvertCoordinateNotation function with UTM_ZONES and UTM_BANDS formats.

# imports
import arcpy

arcpy.env.workspace = r"c:\data\ccn.gdb"

# export_utm58 table contains coordinates in UTM_BANDS format 
# where N and S indicate latitude bands, 
# for example, 58S4144921393176 - here 58S is latitude band
input_table = 'export_utm58'

# the coordinate values in output point table will be in UTM_ZONES format
# for example, 58N4144921393176 - note that it is now 58N because
# the point is in UTM 58 North zone
output_points = 'utm_zone18'

spatial_ref = arcpy.SpatialReference('WGS 1984')

try:
    arcpy.ConvertCoordinateNotation_management(input_table, output_points, "LOCS", "", 
                                               "UTM_BANDS", "UTM_ZONES", "", spatial_ref)
    print(arcpy.GetMessages(0))
    
except Exception as ex:
    print(ex.args[0])
ConvertCoordinateNotation example 4 (stand-alone script)

The following stand-alone script demonstrates how to use the ConvertCoordinateNotation function to convert the output text decimal degree values to floating point values. Note that instead of S and W, a minus sign is used.

# imports
import arcpy

# output from Convert Coordinate Notation tool
# for DD_2 (and also for DD_1) format, the output values are in string format
# for example, for DD_1, the output values may be '43.63872N 116.24135W'
in_table = r"c:\data\ccn.gdb\ccn_dd1"

# add a field of type DOUBLE to store the numeric longitude value
arcpy.AddField_management(in_table, "DDLonDbl", "DOUBLE")

# now call CalculateField tool to convert the values, 'W' is negative
expr = """def convertToDouble(fldval):
    val = float(fldval[:-1])
    if fldval[-1:] == 'W':
        return val * -1.0
    else:
        return val"""

# DDLon field contains longitudes in a string field
arcpy.CalculateField_management(in_table,"DDLonDbl","convertToDouble(!DDLon!)","PYTHON_9.3",expr)
    
# add another field to store the numeric longitude value
arcpy.AddField_management(in_table, "DDLatDbl", "DOUBLE")

# call CalculateField again to convert the values, 'S' is negative
expr = """def convertToDouble(fldval):
    val = float(fldval[:-1])
    if fldval[-1:] == 'S':
        return val * -1.0
    else:
        return val"""

# DDLat field contains latitudes in a string field
arcpy.CalculateField_management(in_table,"DDLatDbl","convertToDouble(!DDLat!)","PYTHON_9.3",expr)

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes

Related topics