What's the easiest way to append an arcsde geodatabase with attachments collected with Collector for arcGIS

1128
6
09-29-2016 03:22 PM
Kerry_-_AnnHarriott1
New Contributor II

I'm looking for an easy way to append an arcsde geodatabase with attachments (relationship class and tables) that were collected with Collector for arcgis. I exported the feature layers to a file geodatabase (in arcgis online) and now i'm looking to update a company arcsde geodatabase. I know an xml export will work however, this creates new feature classes and domains and I don't want to create new feature classes in my existing geodatabase, i want to append existing feature classes and also add the attachments. i've used the simple data loader to load the updated or newly created features but can't seem to find a way to bring in my attachments for those features without creating an xml workspace. I think the trouble is the naming convention for the arcsde geodatabase because i can perform these actions just fine using file geodatabases. append won't work either.

any ideas can help.

6 Replies
ScottFierro2
Regular Contributor

Just want to be sure I am building this scenario correctly. Within your sde you have an existing feature class (<your_FC>). This feature class currently has no <your_FC>__ATTACH table built for it as well as it has no relationship class defining the relationship of the <your_FC> __ATTACH back to the <your_FC>.

Now, you have pulled down your data from AGOL and want to extract just the attachments and apply them against this existing FC in your sde?

This is doable via an ETL using ModelBuilder it's just a matter of understanding what pieces you have and are working with. I am going under the assumption that your existing FC in the sde has records in it already and what was up in AGOL is a mirrored copy so the need is to now provide attachments inside your sde as they exist in AGOL? OR is the need to add new records to the existing FC in sde along with the associated attachments?

0 Kudos
Kerry_-_AnnHarriott1
New Contributor II

Hi Scott

there is a need to add new records collected in the field along with the attachments for the new and existing features.

Thanks much

0 Kudos
Kerry_-_AnnHarriott1
New Contributor II

besides that the scenario is pretty much as you painted

0 Kudos
ScottFierro2
Regular Contributor

OK, so this may be a multi-step process just have to see. So in your original data were there any unique ID fields other than the ObjectID?

The easiest scenario would be, for example, if you were gathering light poles and maintained a data field of unique values for each record. An example of this might be a 3 letter county abbreviation code along with a unique 5 digit number (i.e. Franklin county = FRA and it's the 1st pole collected so it's value is FRA00001). If you have some unique value for each record like this then the process would involve appending just the new records to <your_FC> and then adding gloablID's to <your_FC>

Next, you'd let ESRI create the <your_FC>__ATTACH table by doing the simple right-click in ArcCatalog on <your_FC> and "Create Attachments". This means you have your total record set of existing and appended new values in <your_FC> and an empty <your_FC>_attach. Add a new field to the <your_FC>__ATTACH call it anything you want but ensure it has the same data type as <your_FC> for the unique ID column (discussed above).

From here it's either an Append or Insert of all your unique values into the new field on <your_FC>__ATTACH. The issue now is that <your_FC>__ATTACH will generate a bunch of globalID and rel_globalID values for all these new records. This is where your database skills need to kick in and these steps should be nearly the same regardless of if you are using Oracle or SQL or something else.

From your database tools perform a join of <your_FC> and <your_FC>__ATTACH based on the uniqueID field. Using the join overwrite the rel_globalID field values in <your_FC>__ATTACH with the globalID values from <your_FC>. This step fulfills the needs of the ESRI relationship class and properly associates the record from <your_FC> to the record with the attachment. Next, map the data to populate the fields in <your_FC>__ATTACH and remember your pictures get mapped into the "DATA" field but it may also become necessary for you to script or do manual entry of several of the other data fields (content_type, att_name or data_size) if the information isn't available from what was pulled down out of AGOL.

Once done perform a delete of the column added to <your_FC>__ATTACH with the uniqueID values and you end up with a fully functioning and related source table with related ATTACH table and pictures.

***In the event you did not have a uniqueID field prior to doing all the work it gets trickier because there is no consistent value that exists in your original sde <your_FC> and the new copy of <your_FC> pulled down out of AGOL. This uniqueID value is essentially the 1 constant as the data was moved around and therefor the only piece that really allows you to build the necessary joins to relate the 2 versions of data you have along with doing the 1 to Many style table split you are attempting to perform.

I'd provide you with some screenshots and PDF export of the model builder I used for similar functions but it'd require several and lots of explanation for the workflow.

0 Kudos
Kerry_-_AnnHarriott1
New Contributor II

Thanks much Scott. ..I'll test this out

Kerry-Ann 

Sent from Samsung Mobile

0 Kudos
GeorgeKatsambas
Occasional Contributor III

I would also like to see the model in detail, we tried using a python script to download images from SDE but that would only download the first image in each feature class that is used in Collector. Our work around was to use a python script that accessed our rest URL of the map service and downloads the pics from there, not through catalog or desktop but from the command python window.

0 Kudos