Select to view content in your preferred language

Seeking clarification - AGOL Feature Service/Feature Layer contents not showing in ArcGIS Assistant JSON Data

109
4
4 weeks ago
JasperRomero
Emerging Contributor

Hello All,

Hoping someone can point me towards the right resources, or provide a quick explanation, to help me understand what I'm missing here.

Context:
I am trying to develop a codebase for programmatic replication of various layer properties (e.g. symbology, popup configuration, forms) across different layers with the same fields. Example use cases include automating the production of Feature Layers for use in Field Maps surveys that will have the same forms and symbology each time a new survey layer is generated for periodically recurring surveys, and generating a set of web maps for Web Apps that have different features in each Layer but the same popup configuration for content display across layers (all layers will have the same fields).

The approach I am taking is to create python scripts using the ArcGIS API for python, and as I understand it my best bet for consistently replicating these properties is to pull the relevant piece of the JSON data from the "template" layer and apply it to the new "target" layer with the script. I set up some testing/development layers to play around with as I work out this functionality - here's where I'm getting confused:

Question:
In a single Map in ArcGIS Pro, I made two Point Feature Classes (Template Points and Target Points), then shared them to AGOL as a Web Layer. In my AGOL Content, I now have the hosted Feature Layer "Template Points", which contains the layers "Template Points" and "Target Points" (NOTE: Things get a little confusing now, as there is Template Points Feature Layer - Template Points layer, and Template Points Feature Layer - Target Points layer; certainly not best practice for naming/management but I don't think this is causing the issue). I set up a form and did some popup configuration in the Template Points layer, and saved them to the layer.

When I inspect the JSON Data of the Template Points Feature Service using ArcGIS Assistant, I expect to see the Template Points layer and the Target Points layer in the JSON data - the Feature Layer/Feature Service contain both of these sublayers when viewed in AGOL Content. However, while there are both a layer id 0 and id 1 in the JSON Data, neither one of them appears to be the Target Points layer. Under id 1, the form configuration and the title "Template Points - Template Points" are visible - but there is no title "Template Points - Target Points" anywhere in the form.

Where is the Target Points sublayer? What am I not understanding about the workflow or the data structure?

In the future, I can probably avoid this by sending the different layers (template vs. target) to different Feature Layers - but I really want to understand whatever I'm missing with the JSON data organization of these features.

Thanks in advance for any insights, sorry for the novel, hope everyone is having a good holiday season 🙂

0 Kudos
4 Replies
JasperRomero
Emerging Contributor

Ok - I independently configured a new form for the Target Points layer, saved it to the layer, and now it is showing up under id 0 in the JSON data. Within that dictionary section, the title of the layer - "Template Points - Target Points" is now also visible. So it seems like the move is to figure out the id of your layers outside of the JSON Data, because titles don't necessarily appear unless there is something they are attached to (e.g. a form configuration property)... this still doesn't feel completely intuitive to me, so any insights or clarifications re: the structures and rules for the JSON data is still much appreciated!

0 Kudos
JRhodes
Frequent Contributor

HI Jasper, I believe the information you're looking for is in the service/layer definitions, which are not viewable through ArcGIS Assistant. Go to the item page, and in the lower right, copy the URL:

JosephRhodes2_0-1734637690966.png

Paste it into your browser, appending ?f=json to the end, and if the service is secure, adding &token=<your access token>, like this:

https://services6.arcgis.com/RTYCWyATq5TpQEkX/arcgis/rest/services/service_f2262bfc9e9a47d0abde66b369ac2579/FeatureServer?f=json&token=<your access token>

 

This will give you the service (aka Feature Layer Collection) definition, including layer/table names and IDs. From there, you can access the layer definitions by adding the layer IDs to the URL, e.g.:

https://services6.arcgis.com/RTYCWyATq5TpQEkX/arcgis/rest/services/service_f2262bfc9e9a47d0abde66b369ac2579/FeatureServer/1?f=json&token=<your access token>


For the target layers, Update Definition (Feature Layer)—ArcGIS REST APIs | ArcGIS Developers is likely your ticket. You can also use the ArcGIS API for Python: https://developers.arcgis.com/python/latest/guide/updating-feature-layer-properties 

0 Kudos
JasperRomero
Emerging Contributor

Thanks so much for your response! Definitely some useful resources I hadn't found there. I'll give this a try!

re: access tokens - do all of the options for getting one incur some cost to my AGOL account? This is unfamiliar territory for me. Thanks again!

0 Kudos
JRhodes
Frequent Contributor

Acquiring an access token does not incur credits. There are lots of ways to acquire one, depending on how you're developing, with /generateToken: Generate Token | ArcGIS REST APIs | ArcGIS Developers being one. The Python API has a method as well: gis._con.token

0 Kudos