sarajase

Add Lat/Long coordinates to an UTM shape file

Discussion created by sarajase on Sep 13, 2013
Latest reply on Sep 13, 2013 by timw1984dev
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"

Outcomes