Update/Add Attachments to Hosted Layer

2207
5
Jump to solution
09-04-2021 06:18 AM
NealBanerjee
Occasional Contributor

Hello,

We have been using Arc Collector to collect thousands of features in the field.  The layers are hosted on AGOL.  Many collected features have one or more photos associated with them (captured through Collector). We have processes/tools to pull down the AGOL data and process the photos (renaming, reducing file size, etc.), but I dont see a clear way to push the processed photos back to AGOL hosted layer.

I tried using the 'Remove Attachments' and 'Add Attachments' tools in Arc Pro (similar to what we do for GDBs on our network), but does not seem to work.  The only other thing I can think of is to copy AGOL layers down locally, process photos and reset attachments, delete all the features in the hosted layer, and then maybe append the local data into hosted layer.

Is there a better way?

Any thoughts would be appreciated

Thanks

Neal

0 Kudos
1 Solution

Accepted Solutions
NealBanerjee
Occasional Contributor

Temporary Solution:  I tried deleting the features in the web layer and then appending the features with reduced photos (through Arc Pro 'Delete Features' and 'Append' tools), but the attachments did not come through.  Note quite the process I had hoped for but solution I used below was pretty simple.

So process that worked was:

1.  Download AGOL web layer as FGDB

2. Perform picture processing (renaming, resizing, etc.) with local tools

3. Overwrite AGOL web layer by publishing from Arc Pro with processed data

View solution in original post

0 Kudos
5 Replies
jcarlson
MVP Esteemed Contributor

Take a look at the Attachment Manager submodule of the Python API.

In particular, there is an update function. Using this requires you knowing the attachment ID of the file in question. It's possible to use the search function to get a list of all attachments in the layer, then using the values in that list, you could iteratively download, process, and update the files that way.

I don't know what your processes look like that you mention in your post, but if you have a way of maintaining the list of attachment IDs associated with each file, perhaps by exporting the search results, you should be able to use that when updating the files.

Can you elaborate on the existing process you have in place?

- Josh Carlson
Kendall County GIS
NealBanerjee
Occasional Contributor

Thanks Josh - appreciate the suggestion.  I posted the lower-tech solution I ended up doing, but Ill look into the Python API since that seems like a more sophisticated/programmatic way to do it

0 Kudos
NealBanerjee
Occasional Contributor

Temporary Solution:  I tried deleting the features in the web layer and then appending the features with reduced photos (through Arc Pro 'Delete Features' and 'Append' tools), but the attachments did not come through.  Note quite the process I had hoped for but solution I used below was pretty simple.

So process that worked was:

1.  Download AGOL web layer as FGDB

2. Perform picture processing (renaming, resizing, etc.) with local tools

3. Overwrite AGOL web layer by publishing from Arc Pro with processed data

0 Kudos
LMedeirosUI
Occasional Contributor

@NealBanerjee I am having a similar issue adding features to a hosted feature layer - I can't seem to get the attachments to go with the attribute data. Ultimately, all I want to do is copy or append rows from one table to another. A view of the hosted feature layer won't work because I need to be able to delete certain attachments and I don't want that to affect the hosted feature layer. Using the "Update Data" tool in AGOL just does not seem to want to bring in attachments AND it uploads the row data in an odd order that has no logic I can see. This seems like it should be a very easy task, but I've been trying to get this done for months and can't figure it out.

I have access to Arc Pro, but can't figure out to overwrite the AGOL web layer by publishing from Arc Pro. Could you tell me how? Or direct me to some info/documentation? I feel like a complete idiot. Please help!

hsummers_scf
New Contributor II

I have a similar question. I'm trying to update a feature class in ArcGIS Online that has attachments using the "Update Data" button. Everything is coming through, but the attachments. 

0 Kudos