I have some simple code that projects a point.
pt = arcpy.PointGeometry(arcpy.Point(687577.9340000004, 2134343.1621000003), spatial_reference="USA_Contiguous_Albers_Equal_Area_Conic_USGS_version")
pt_projected = pt.projectAs('4326')
print ("Projected x,y : %s,%s" % (str(pt_projected.firstPoint.X), str(pt_projected.firstPoint.Y)))
It seems to return different results as shown below. This first is produced when running in the ArcGIS Pro 3.1 Python window and also in my Spyder/IPython environment. The second is produced when I run it in a python toolbox (and I think when I run it after publishing the toolbox to an ArcGIS Server). Can anybody explain this difference?
Projected x,y : -87.63855949198765,41.938884076168215
Projected x,y : -87.63856525044517,41.93889193970926
Solved! Go to Solution.
have you ruled out 64bit vs 32bit precision differences between the platforms?
is there transformation option for projectAs that isn't accounted for?
Seen before...
Solved: Using 'projectAs()' Point Geometry Function Via Py... - Esri Community
have you ruled out 64bit vs 32bit precision differences between the platforms?
is there transformation option for projectAs that isn't accounted for?
Seen before...
Solved: Using 'projectAs()' Point Geometry Function Via Py... - Esri Community
I added the 'transformation_name' parameter on the projectAs call and now I get the same results in all environments. Thanks for the pointer Dan!
pt = arcpy.PointGeometry(arcpy.Point(687577.9340000004, 2134343.1621000003), spatial_reference="USA_Contiguous_Albers_Equal_Area_Conic_USGS_version")
pt_projected = pt.projectAs('4326','WGS_1984_(ITRF00)_To_NAD_1983')
print ("Projected x,y : %s,%s" % (str(pt_projected.firstPoint.X), str(pt_projected.firstPoint.Y)))