Skip to main content
Solved

Modify relationships for ArcGIS Online view

  • September 30, 2024
  • 4 replies
  • 50 views

georgiec
Contributor
Forum|alt.badge.img+2

I am writing a workflow that refreshes data within a hosted AGOL feature service.

To enable continuity of service, I have 2 hosted feature services for the same layer.  eg.  Playgrounds_A and Playgrounds_B.    There is a view defined called Playgrounds_View whose source is either Playgrounds_A or Playgrounds_B 

My workspace plan is to refresh the contents of the ‘non-active’  feature service, and then set the Playgrounds_View to point to it.

I have managed this previously with Python for ArcGIS scripts using commands like item.add_relationship() and item.delete_relationship()

How can I recreate this functionality in FME workbench ?

Best answer by todd_davis

Since you already have the python, you could setup FME to utilise the ArcGIS Python API. Not a bad approach at all, since you already have the process.

 

Or you could do the switch using the rest api services in esri. Esri does this when swapping source layer for a view

 
If you look at that process via the UI (or via the calls that are made in your python process), you’ll probably find there is a lot going on. But in reality, a lot of it is just a query of the source service which is used in the updating of the view.
 
 
 
View original
Did this help you find an answer to your question?

4 replies

bwn
Evangelist
Forum|alt.badge.img+26
  • Evangelist
  • September 30, 2024

Either user the PythonCaller Transformer, or set the Workspace Scripting Parameter to run Python code on Workspace Shutdown.


todd_davis
Influencer
Forum|alt.badge.img+22
  • Influencer
  • Best Answer
  • September 30, 2024

Since you already have the python, you could setup FME to utilise the ArcGIS Python API. Not a bad approach at all, since you already have the process.

 

Or you could do the switch using the rest api services in esri. Esri does this when swapping source layer for a view

 
If you look at that process via the UI (or via the calls that are made in your python process), you’ll probably find there is a lot going on. But in reality, a lot of it is just a query of the source service which is used in the updating of the view.
 
 
 

georgiec
Contributor
Forum|alt.badge.img+2
  • Author
  • Contributor
  • October 1, 2024

@todd_davis   I’m yet to learn how to execute python from FME.  When you say “setup FME to utilise the ArcGIS Python API. “  Is that anything other than using the PythonCaller transformer ?

If I run rest calls, which transformer is that done with ?


todd_davis
Influencer
Forum|alt.badge.img+22
  • Influencer
  • October 1, 2024

Hi,

You can install the ArcGIS API for python via

https://docs.safe.com/fme/html/FME-Form-Documentation/FME-Form/Workbench/Installing-Python-Packages.htm

I don’t use that python library, because I prefer to make calls directly to the API (This is done via httpcaller and breaking up/creating detail with the Json transformers)

 

But to then utilise you existing python, use the pythoncaller transformer.

Unlike running in Esri, you will need to at least have your python inside a python function. But that could look as simple as this:

Please note, you will likely only want one feature going into the python caller, as multiple would initiate the same script multiple times in this instance.

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings