Select to view content in your preferred language

Accessing Portal Data Store Data in ArcPy

05-03-2019 10:36 PM
New Contributor III

I'm trying to write a Web Tool (GP Service) that references a hosted feature service that I have published in Portal.

For example: I want to do a spatial join (intersect) with an input point location to a hosted feature service boundary.  If I reference the feature service REST endpoint in the operation, it works fine.  However, publishing as a web tool requires that I choose 'copy' the data and cannot access it by reference because it says the service is not registered with the server.

Ideally, I'd like to write a Web Tool (GP Service) that operates by reference to the actual data and not needing to copy any data.

I tried using a combination of ArcGIS API for Python and ArcPy.  Instead of referencing the item by URL, I used `gis.content.get(id)` to get the item by ID and tried passing the feature layer `.layers[0]' into the Spatial Join operation.  That didn't work.

How do you write ArcPy scripts to work with data/services as hosted feature services without needing to copy any data when publishing GP Services?

0 Replies