Moving attachments onto Signature field

562
3
Jump to solution
02-09-2022 07:52 AM
CBarrett
New Contributor II

The blog post yesterday about getting attachments out of Survey123 with the survey got me thinking. I have some older surveys with signature images as Attachments to the survey, but not associated with the signature questions in the survey.

Is there a way to repair these surveys in Survey123? To move the attached images from the survey to a specific survey question?

Thanks,

Clay

0 Kudos
1 Solution

Accepted Solutions
ZacharySutherby
Esri Regular Contributor

Hello @CBarrett

Attachments are associated with image questions through attachment keywords. 

ZacharySutherby_0-1644440152711.png

 

The keyword is going to be the name of the image question in your XLSForm. We do have a Python notebook that assists with updating keywords on attachments. 

Even though the notebook mentions that it's for ArcGIS Enterprise the workflow will also work with ArcGIS Online as well. 

Thank you,
Zach

View solution in original post

0 Kudos
3 Replies
ZacharySutherby
Esri Regular Contributor

Hello @CBarrett

Attachments are associated with image questions through attachment keywords. 

ZacharySutherby_0-1644440152711.png

 

The keyword is going to be the name of the image question in your XLSForm. We do have a Python notebook that assists with updating keywords on attachments. 

Even though the notebook mentions that it's for ArcGIS Enterprise the workflow will also work with ArcGIS Online as well. 

Thank you,
Zach
0 Kudos
CBarrett
New Contributor II

This looks perfect @ZacharySutherby.

Any chance you have another handy notebook that will fix the black borders issues from signature JPGs?

0 Kudos
ZacharySutherby
Esri Regular Contributor

Hello @CBarrett

I don't have an explicit full workflow, but from some quick testing there looks to be a Python module called Pillow that ships with ArcGIS Pro by default and can be used to crop the images. 

I had tested the copping workflow from this article against the image posted in this Esri Community article and it seemed to work well. 

The code that I had used was:

from PIL import Image

img = Image.open(r"C:\temp\signature.jpeg")
width, height = img.size

area = (0,0, width/2, height/2)
img = img.crop(area)
img.save(r"C:\temp\cropped_signature.jpeg" 

The crop area may be different for your specific images. 

If you download all your attachments you could crop the ones that need to be cropped and then update the attachments in your feature service using the Python API

 

Thank you,
Zach
0 Kudos