ArcPy feature selection from service housed in different organization

258
2
Jump to solution
08-10-2021 03:57 PM
GB_MattPanunto_GISS
Occasional Contributor

In my experience, ArcPy seems to perform better with selecting features from very large feature services, compared to making feature queries via the ArcGIS API. With that, I have a script that performs a series of ArcPy feature selections using feature layer URLs and an area of interest feature class, like this:

 

selection = arcpy.SelectLayerByLocation_management(fl_url, overlap_type="INTERSECT", select_features=aoi_fc)

 

Problem is, I want to perform these selections using services hosted in an ArcGIS Online Organization that differs from my Licensing Portal Organization. I have an ArcGIS Online account with the desired organization, so I'm able to establish a connection via the ArcGIS API, but ArcPy access seems to be tied to a user's ArcGIS Pro license, not the API connection. Is there a way I can use ArcPy to select features from a service not housed within my Licensing Portal's Organization?

0 Kudos
1 Solution

Accepted Solutions
DavidPike
MVP Frequent Contributor

Possibly SignInToPortal—ArcGIS Pro | Documentation which then sets it to the active portal (which allows the content to be used).  You may have to first use it to reference your named user license portal, then again to the other org's portal.  This is not from experience and just a shot in the dark.

View solution in original post

0 Kudos
2 Replies
DavidPike
MVP Frequent Contributor

Possibly SignInToPortal—ArcGIS Pro | Documentation which then sets it to the active portal (which allows the content to be used).  You may have to first use it to reference your named user license portal, then again to the other org's portal.  This is not from experience and just a shot in the dark.

0 Kudos
GB_MattPanunto_GISS
Occasional Contributor

Ahhh, that did it! Thanks!

0 Kudos