Convert Coordinate Notation (Data Management)

License Level:BasicStandardAdvanced

Summary

Converts coordinate notations representing locations from one format to another.

Learn more about supported notation formats

Usage

Syntax

ConvertCoordinateNotation_management (in_table, out_featureclass, x_field, y_field, input_coordinate_format, output_coordinate_format, {id_field}, {spatial_reference})
ParameterExplanationData Type
in_table

The table containing the fields with coordinate notations to convert.

Table View
out_featureclass

The output feature class of points. 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 DD_2, DDM_2, and DMS_2, this is the longitude field.

For DD_1, DDM_1, DMS_1, GARS, GEOREF, UTM, USNG, and MGRS, this is the field containing both latitude and longitude.

Field
y_field

A field from the input table containing the latitude value. For DD_2, DDM_2, and DMS_2, this is the latitude field. This parameter is ignored for DD_1, DDM_1, DMS_1, GARS, GEOREF, UTM, USNG, and MGRS.

Field
input_coordinate_format

Coordinate format of the input fields. The default is DD_2.

  • 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.
  • 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.
  • UTMBased on the Universal Transverse Mercator projection. It divides the world into 6-degree slices of longitude, which are divided into 20 latitude bands. These grids are further described using eastings and northings to locate any point within the grid.
  • USNGUnited States National Grid. Almost exactly the same as MGRS but uses North American Datum 1983 (NAD83) as its datum.
  • 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.
  • 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, and DMS 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 number tell whether the values are coming from one field or two fields.

String
output_coordinate_format

Coordinate format to which the input notations will be converted. The default is DD_2.

  • 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.
  • 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.
  • UTMBased on the Universal Transverse Mercator projection. It divides the world into 6-degree slices of longitude, which are divided into 20 latitude bands. These grids are further described using eastings and northings to locate any point within the grid.
  • USNGUnited States National Grid. Almost exactly the same as MGRS but uses North American Datum 1983 (NAD83) as its datum.
  • 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.

DD, DDM, and DMS 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 number tell whether the values are coming from one field or two fields.

String
id_field
(Optional)

Any field from the input table. The selected field will be copied to the output table. If the values of this field are unique, this may be used to join the output records back to the input table.

Field
spatial_reference
(Optional)

Spatial reference of the output point feature class. The default is GCS_WGS_1984.

If the output has a different coordinate system than the input, then the tool projects the data. If the input and output are in different datum, then a default transformation is calculated based on the coordinate systems of the input and the output, and the extent of the data.

Spatial Reference

Code Sample

ConvertCoordinateNotation example 1 (stand-alone script)

ConvertCoordinateNotation usage with one input format field.

#Imports
import arcpy

#Locals
in_tab = r"c:\workspace\inmed.gdb\loc_mgrs"
out_pts = r"c:\workspace\inmed.gdb\loc_final"

#Convert Coordinate Notation with MGRS as input field.
arcpy.ConvertCoordinateNotation_management(in_tab,out_pts,"m10d","#","MGRS","DD_1")
ConvertCoordinateNotation example 2 (stand-alone script)

ConvertCoordinateNotation usage 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])

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: Yes
ArcGIS for Desktop Standard: Yes
ArcGIS for Desktop Advanced: Yes
11/18/2013