Randy,
Thanks for the code snippet. I’ll give it a try. If it works properly then I’ll need to incorporate into bigger script.
Regards,
Jim
Randy,
Thanks for the code snippet. I’ll give it a try. If it works properly then I’ll need to incorporate into bigger script.
Regards,
Jim
Did this work - using a projection file?
sr = arcpy.SpatialReference(r"S:\General-Offices-GO-Trans\SLR-Mapping\GIS_Projects_2018\Smart_T_Line_Model\geodata\templateUTM.prj")
featureClassList = arcpy.ListFeatureClasses()
for featureClass in featureClassList:
arcpy.management.CalculateGeometryAttributes(featureClass, "X_coord POINT_X;Y_coord POINT_Y", None, None, sr)
The false easting/false northing values have to use the same linear unit as the projected coordinate system itself. The well-known text string is using international feet (1 ft = 0.3048 m) but the false easting value is defined in meters.
Hi Melita,
I have side question. Is there a way to project a DEM raster, from geographic to UTM15N US feet, so that the grid code z-value changes from meters to feet? Do you have to go into the spatial reference properties and the "Z coordinate system" tab and pick from there (see image below)? If so, what would the best parameter to use.
It seems that without setting a z value no change conversion to feet is evident after running Project Raster.
Thank-You,
Jim
Here is the final script that seemed to do the trick:
This script will loop thru and calculate geometry fields
X_coord and Y_coord from geographic to NAD_83_UTM_Zone_15N_Feet
import arcpy
arcpy.env.overwriteOutput = 1
outrastertopoint = r"S:/General-Offices-GO-Trans/SLR-Mapping/GIS_Projects_2018/Smart_T_Line_Model/geodata/NSP_RASTERTOPOINT_FT.gdb/"
arcpy.env.workspace = outrastertopoint
fieldName1 = "X_coord"
fieldPrecision1 = 9
fieldAlias1 = "longitude"
fieldName2 = "Y_coord"
fieldPrecision2 = 9
fieldAlias2 = "latitude"
#Spatial reference set using .prj file. False easting field is key to get positive values in X_coord.
sr = arcpy.SpatialReference(r"S:\General-Offices-GO-Trans\SLR-Mapping\GIS_Projects_2018\Smart_T_Line_Model\geodata\coord_sys_UTM15FT.prj")
#Loop thru list of 1,455 features
featureClassList = arcpy.ListFeatureClasses()
for featureClass in featureClassList:
arcpy.management.CalculateGeometryAttributes(featureClass, "X_coord POINT_X;Y_coord POINT_Y", None, None, sr)
The spatial reference code 32165 does not provide the right values so I'm hoping to use a .prj file instead for the spatial reference. In the script below is there a way to use "sr" (spatial reference) as a parameter in the arcpy.management.CalculateGeometryAttributes command line?