Add Lat/Long coordinates to an UTM shape file

3160
2
09-13-2013 08:56 AM
D__SamuelRajasekhar
New Contributor III
Hello All,

I am not able to find a tool (or function) that would add geographic coordinates say DD or DMS to a shape file that is in UTM (or other projected systems). When I add a field and calculate using the !shape.extent!  in the window, I get only the UTM coordinates. When I use the ADDXY tool, the same.

How can I add additional geographic coordinates to the shape file without re-projecting the datasets?

Thanks,
Samuel Rajasekhar

import arcpy
import os
from arcpy import env
arcpy.env.overwriteOutput = False

arcpy.env.workspace = r'\\GISARL01\AerialStaging\BPSDelivery_080813\BPS8-Delivery\WO_80_Early_1980s_CIR_NHAP_WI_IL_IN_OH_GA_2nd\Index'

# Set the input feature (Shape file, geo-databse polygon feature, etc of Index)

inputFeature = "Foot_Prints_WGS84_NoCollar.dbf"


arcpy.AddField_management(inputFeature, "MinLat", "DOUBLE", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")
print"MinLat Field added"

arcpy.AddField_management(inputFeature, "MinLon", "DOUBLE", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")
print"MinLon Field added"

arcpy.AddField_management(inputFeature, "MaxLat", "DOUBLE", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")
print"MaxLat Field added"

arcpy.AddField_management(inputFeature, "MaxLon", "DOUBLE", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")
print"MaxLon Field added"

arcpy.AddField_management(inputFeature, "CenterLat", "DOUBLE", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")
print"CenterLat Field added"

arcpy.AddField_management(inputFeature, "CenterLon", "DOUBLE", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")
print"CenterLon filed added"

arcpy.CalculateField_management(inputFeature, "MinLat", "!SHAPE.EXTENT.YMIN!", "PYTHON_9.3", "")
print"MinLat Field calculated"

arcpy.CalculateField_management(inputFeature, "MinLon", "!SHAPE.EXTENT.XMIN!", "PYTHON_9.3", "")
print"MinLon Field calculated"

arcpy.CalculateField_management(inputFeature, "MaxLat", "!SHAPE.EXTENT.YMAX!", "PYTHON_9.3", "")
print"MaxLat Field calculated"

arcpy.CalculateField_management(inputFeature, "MaxLon", "!SHAPE.EXTENT.XMAX!", "PYTHON_9.3", "")        
print"MaxLon Field calculated"

arcpy.CalculateField_management(inputFeature, "CenterLat", "!SHAPE.CENTROID.Y!", "PYTHON_9.3", "")
print"CenterLat Field calculated"

arcpy.CalculateField_management(inputFeature, "CenterLon", "!SHAPE.CENTROID.X!", "PYTHON_9.3", "")
print"CenterLon Field calculated"
0 Kudos
2 Replies
D__SamuelRajasekhar
New Contributor III
Hello All,

I am not able to find a tool (or function) that would add geographic coordinates say DD or DMS to a shape file that is in UTM (or other projected systems). When I add a field and calculate using the !shape.extent!  in the window, I get only the UTM coordinates. When I use the ADDXY tool, the same.
How can I add additional geographic coordinates to the shape file without re-projecting the datasets?

Thanks,

Samuel
0 Kudos
TimWitt
Frequent Contributor
Samuel,

Add a Lat and Long field to your feature (data type double). Right click the heading of your field and click "Calculate Geometry...". Property choose X or Y Coordinate of your point (depending if you calculate your Lat or your Long field) and as "Units:" choose "Decimal Degrees". This will calculate it for all your features.

Hope this helps!
0 Kudos