Update/Add Attachments to Hosted Layer

456
3
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
3 Replies
jcarlson
MVP Notable 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