Select to view content in your preferred language

Adding photos overnight to ESRI Online Map and Categorizing them

1089
2
Jump to solution
02-02-2021 01:33 PM
VictorZhou1
Occasional Contributor

Hi,

I'm just wondering if anyone tried this.

We have a cloud based data collection system that we use, it downloads a GIS file (Shape File, Tab File, CSV, etc...) as well as images collected overnight. So the GIS file will be overwritten with the most up to date one and the photos will just be added to a photo folder. There will also be a link file linking the photos to the GIS records.

I'm wondering if there is a way to display the GIS file on ESRI online along with the photos and have them updated overnight.

Currently we are doing it manually, when we need to update, we will load up the ESRI online map in ArcGis Pro and replace the layer with the updated one and attach all photos again. We will then save the map (to ESRI online).

This is a bit inefficient as we will need to re-upload records that did not change. I know there is a way to append/ update records in ESRI online but is there a way to append/ update photos as well?

 

Second question is. Is there a way to group attachments/ photos together. Currently ESRI online will just have an attachment section for all attachments, is there a way to group them in say "Before photo" and "After Photo".

 

Thanks.

0 Kudos
1 Solution

Accepted Solutions
MehdiPira1
Esri Contributor

Hi @VictorZhou1 ,

Yes, it's possible to manage attachments in a feature layer using ArcGIS API for python.

This link provides an example of how to use the attachment property.

and the following link is the API reference:

https://developers.arcgis.com/python/api-reference/arcgis.features.managers.html?highlight=attachmen...

and this link shows how to update/append a hosted feature layer:

https://community.esri.com/t5/python-questions/append-to-hosted-feature-layer-from-local-gdb-python/...

I hope that helps.

 

======================================================================

Please give a like if helpful and Accept as Solution if it's answered your query.

View solution in original post

0 Kudos
2 Replies
MehdiPira1
Esri Contributor

Hi @VictorZhou1 ,

Yes, it's possible to manage attachments in a feature layer using ArcGIS API for python.

This link provides an example of how to use the attachment property.

and the following link is the API reference:

https://developers.arcgis.com/python/api-reference/arcgis.features.managers.html?highlight=attachmen...

and this link shows how to update/append a hosted feature layer:

https://community.esri.com/t5/python-questions/append-to-hosted-feature-layer-from-local-gdb-python/...

I hope that helps.

 

======================================================================

Please give a like if helpful and Accept as Solution if it's answered your query.

0 Kudos
VictorZhou1
Occasional Contributor

Thanks, the links are quite useful.

In case others who want to achieve something similar, this is how I did it:

----Update the map objects/ attribute----

1. Prepare data to be imported so it has all the information and columns

2. Upload data file to AGOL (gis.content.add)

3. Analyse data file if it is a CSV or XLSX (gis.content.analyze)

4.Update/ Append Data to existing layer (.append)

----Upload the photos----

5.Get the list of attachment/ photos that are already in that layer so you don't reupload them (Lyr_to_Update.attachments.search(where=a Query to include all records ,as_df=True)

This generates a dataframe with all attachments and their information.

6.Exclude the attachments in the above dataframe from your file that links the photo and map object.

7.Loop through the remaining entries in your file to upload photo to AGOL.

0 Kudos