def dd2DMS(dd): if dd > 0: deg = int(dd) min = int((dd-deg) * 60) sec = (((dd - deg) * 60) - min) * 60 return str(deg) + " " + str(min) + "' " + "%.4f" % sec + '"' if dd < 0: deg = int(dd) min = int((dd-deg) * 60 * -1) sec = (((dd - deg) * 60 * -1) - min) * 60 return str(deg) + " " + str(min) + "' " + "%.4f" % sec + '"'
dd2DMS(!POINT_X!)
import arcpy from arcpy import env env.workspace = r"C:\temp\python\test.gdb" fc = "Cities_Meters" prj = r"C:\Program Files (x86)\ArcGIS\Desktop10.0\Coordinate Systems\Geographic Coordinate Systems\World\WGS 1984.prj" spatRef = arcpy.SpatialReference(prj) env.geographicTransformations = "NAD_1983_To_WGS_1984_1" rows = arcpy.UpdateCursor(fc, "", spatRef) for row in rows: geom = row.shape row.POINT_X = geom.centroid.X row.POINT_Y = geom.centroid.Y rows.updateRow(row) del row, rows
def func(): fc = "Cities_Meters" prj = r"C:\Program Files (x86)\ArcGIS\Desktop10.0\Coordinate Systems\Geographic Coordinate Systems\World\WGS 1984.prj" spatRef = arcpy.SpatialReference(prj) arcpy.env.geographicTransformations = "NAD_1983_To_WGS_1984_1" rows = arcpy.UpdateCursor(fc, "", spatRef) for row in rows: geom = row.shape return geom.centroid.X
func()
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.