Select to view content in your preferred language

arcpy.projectAs returns different results depending on where it is run

416
2
Jump to solution
04-29-2023 06:24 PM
DonMorrison1
Occasional Contributor III

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

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
DanPatterson
MVP Esteemed Contributor

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


... sort of retired...

View solution in original post

2 Replies
DanPatterson
MVP Esteemed Contributor

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


... sort of retired...
DonMorrison1
Occasional Contributor III

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)))

 

0 Kudos