Select to view content in your preferred language

Arcpy Script behavior different inside Pro - Projection Issues

463
3
02-14-2022 07:54 AM
RVx_GaslineGiS
New Contributor III

I have a script that, among other things, conducts a Clip operation between two line feature classes. When I run the script in Spyder, I get ~3000 features in the resulting clip. When I run that same script in an ArcGIS Notebook in Pro, I get ~30 features.

I assume this is an issue caused by 'on the fly' projection in Pro.

However, I'm also unable to use the Project tool on either feature class. One is in WGS 1984 Major Auxiliary Sphere projected into Web Mercator and the other is in NAD 1983 with a StatePlane projection. However, the Project tool's drop-down list of transformations all give an ERROR 000365: Invalid Geographic Transformation. This confuses me since the transformation from NAD 1983 to WGS 1984 exists and...should work, but instead just reports that error?

I'm not sure what steps to take next here. I want to be able to test this script in an ArcGIS Notebook and have it work the same way it does when running outside of Pro. The script does make use of Feature layers so it will inevitably do on the fly projection when run in Pro. What can I check to try and get the Project tool to work so I can write a project into the script?

 

 

0 Kudos
3 Replies
DanPatterson
MVP Esteemed Contributor

Can you do the Project manually in Pro? If so, copy it to a python snippet and use what you need in your code


... sort of retired...
0 Kudos
Luke_Pinner
MVP Regular Contributor

Make sure you haven't got any features selected in either layer in Pro. The tool will respect any selections.

0 Kudos
HannesZiegler
Esri Contributor

I'll echo @Luke_Pinner, the first thing I'd check is whether features are selected in Pro. You said the script does some other things, make sure one of those things isn't creating a selection. After that (or before, order doesn't matter), also check that you don't have an application-wide geoprocessing extent set, the geoprocessing environment hierarchy is described here.

0 Kudos