Export to FGDB AND Create Replica Fail Feature Service with Attachments

2202
6
Jump to solution
05-18-2017 07:43 AM
ScottRutzmoser2
New Contributor III

I am trying to backup a feature service with attachments.

Both the export data (from the details page) and the Create Replica (from the REST endpoint) fail.

It is only 1500 features but some of the attachments are pretty large.

I was able to export the features in ArcGIS Pro but I am unable to export the attachments.

When I look at the table online it 'appears' that some of the features are missing although they all show up in the maps.

Any help is appreciated.

https://services.arcgis.com/VXxCfMpXUKuFKFvE/ArcGIS/rest/services/Signs_Vendor_Editing/FeatureServer... 

See screen grabs for settings in the create replica.

1 Solution

Accepted Solutions
ScottRutzmoser2
New Contributor III

Kelly,

Thanks for the information about the attachments, I noticed a few of them were corrupt.  As a work around I was able to pull the JASON file for the features...

https://services.arcgis.com/VXxCfMpXUKuFKFvE/arcgis/rest/services/Signs_Vendor_Editing/FeatureServer... 

, and then for the attachments...

https://services.arcgis.com/VXxCfMpXUKuFKFvE/arcgis/rest/services/Signs_Vendor_Editing/FeatureServer... 

from the REST Services.  

With a little work in Excel I was able to take the 1:M JSON to a flat table and I wrote a script to construct urls and download the attachments to files.

I was then able to re-attach them to features in a local database.

I will try to delete the corrupt attachments and see if  I can download the FGDB as a whole.  

Thought I would post my work around in case some else (I'm sure) has this same problem, I know for us it represents literally 100's of man hours in the field, but we have to be able to get the final database to our servers.

I ran into this issue simply trying to backup a few weeks of field work to a local copy, just in case.

-Scott

View solution in original post

6 Replies
ScottRutzmoser2
New Contributor III

One other thing, I thought the service definition file might be hosed, I was able to download it but is is 1.8 GB, 

 I have never came across a service definition file that is quite this large.

-Scott

0 Kudos
KellyGerrow
Esri Frequent Contributor

Hi Scott,

Try contacting Technical Support they can help look into this issue. Generally this happens if for some reason an attachment isn't correctly uploaded to the feature service or there was some sort of network failure. What happens is the layer can't download an attachment that isn't there. If you want to troubleshoot this to find the problematic attachement, Try running the create local copy tool in ArcMap while fiddler (web Debugging tool is running) you can monitor each request for an attachment using this method and determine the problematic attachment. From there, you can delete or modify the problematic attachment so the replica will download.

Add: ArcGIS REST API 

Delete: ArcGIS REST API 

Thanks,

Kelly

0 Kudos
ScottRutzmoser2
New Contributor III

Kelly,

Thanks for the information about the attachments, I noticed a few of them were corrupt.  As a work around I was able to pull the JASON file for the features...

https://services.arcgis.com/VXxCfMpXUKuFKFvE/arcgis/rest/services/Signs_Vendor_Editing/FeatureServer... 

, and then for the attachments...

https://services.arcgis.com/VXxCfMpXUKuFKFvE/arcgis/rest/services/Signs_Vendor_Editing/FeatureServer... 

from the REST Services.  

With a little work in Excel I was able to take the 1:M JSON to a flat table and I wrote a script to construct urls and download the attachments to files.

I was then able to re-attach them to features in a local database.

I will try to delete the corrupt attachments and see if  I can download the FGDB as a whole.  

Thought I would post my work around in case some else (I'm sure) has this same problem, I know for us it represents literally 100's of man hours in the field, but we have to be able to get the final database to our servers.

I ran into this issue simply trying to backup a few weeks of field work to a local copy, just in case.

-Scott

KellyGerrow
Esri Frequent Contributor

Thanks Scott,

Ideally, this wouldn't be required at all. If you find a specific workflow where you there are corrupt attachment workflows, don't hesitate to contact Support or post your workflow so we can look into it further.

-Kelly

0 Kudos
GFlonk
by
New Contributor III

I encountered the exact same issue today. Both the option to export to FGDB via the AGOL GUI, as creating a replica via the REST endpoint fails. I have a featureservice with a few geometry layers, each with its own related standalone table. The standalone tables have attachments enabeled. I can export all of the layers, except for one standalone table (this one layer is also causing the 'create replica' to fail). I have been able to create replica's previously. The featureservice hoewever was taken offline of edits, and re-uploaded to AGOL.

Retrieving the attachments is now problematic since the create replica option is the only way to get the attachments tables to download.

I'd like to know if there is any way to check which attachments are corrupted, or if there is another workaround. I'm rather proficient with Python and JavaScript, so if anyone could share code/a workflow that would be amazing. I'd rather not go through the process described by scott.

I find it rather odd that creating featureservices with attachments, and collecting photos in the field with collector is so easy, while retrieving these attachments after field-collection has to be such a hassle (a "Download Attachments" GUI option would be brilliant). 

Cheers

ScottRutzmoser2
New Contributor III

You can pull the attachment url using the queryAttribute REST call.

https://services.arcgis.com/VXxCfMpXUKuFKFvE/ArcGIS/rest/services/Field_Observations/FeatureServer/0... 

I used the json response to get these into an excel spreadsheet....I used json2table.com 

You will need to work the columns some because it it s a 1:many relationship (typically)

Ultimately you will want to create a new column and concatenate parentID or with the ID of the attachment to create url to each attachment....it looks like this may already come out in the html format...but it should look something like this:

https://services.arcgis.com/VXxCfMpXUKuFKFvE/ArcGIS/rest/services/Field_Observations/FeatureServer/0...

The pattern is FeatureServer/0/(Parent ObjectID)/attachments/(Child ObjectID)

I was dealing with thousands of attachments so I used a script in excel to crawl the url and download the attachment into a folder.

excel - GET pictures from a url and then rename the picture - Stack Overflow 

This script adds a field which provides the status of the download.

I was then able to download the shapefile...you should be able to export to csv and then rebuild FGDB and attach the images to the table using the add attachment tools.

http://pro.arcgis.com/en/pro-app/tool-reference/data-management/add-attachments.htm

Not quite as brilliant as a download attachments button but Hopefully this helps.