Calculate Geometry of any field

277
0
01-11-2019 02:49 PM
sotokan80_
New Contributor III

I am using ArcGIS 10.4.1 and Network Analyst extension. As an IDE i use Spyder and Python version 2.7.

I want to have fields in my shapefile that will present coordinates in WGS 84 and in a national Grid format respectively. The initial information is in WGS 84 format. Is it possible to calculate geometry of the fields that will present the coordinates in the national Grid format? Currently i am achieving that by updating the shapefile with a cursor and running for every line the following script which is very time consuming.

point_utm = arcpy.PointGeometry(arcpy.Point(float(row[12]),float(row[13])),arcpy.SpatialReference("WGS 1984"), trsf)

pointA = point_utm.projectAs(out_coordinate_system, trsf)
row[10] = pointA.centroid.X
row[11] = pointA.centroid.Y

I dont want to use   # Generate the extent coordinates using Add Geometry Properties tool#
 arcpy.AddGeometryAttributes_management(in_features, properties, length_unit, area_unit, coordinate_system) because it updates POINT_X and POINT_Y fields thus losing WGS84 coordinates format.

0 Kudos
0 Replies