Getting image out of ODK Aggregate MySQL database

I am struggling with understanding how to pull images from the database, as described
here https://groups.google.com/forum/#!topic/opendatakit/uzMy9az9eGE.

From that thread :

The blobKey identifies the image. As with all URLs, the parameters are
URLEncoded which makes them very ugly. The URLDecoded blobKey looks like:

geo_tagger_v2[@version=null and @uiVersion=null]/geotagger[@
key=uuid:f6454ba6-2485-426f-8e1a-8981e463e6fe]/Image

This is an XPath-style naming for the image element in the Xform. It
identifies the form id: get_tagger_v2, the version and uiVersion values
(from the attributes on the Xform's top-level element), the name of the
top-level element in the form (geotagger), the primary key for the
submission being referenced (uuid:f6454ba6-2485-426f-8e1a-8981e463e6fe) and
the XPath within the form to the image. In this case, the image (field
name Image) is immediately underneath the top-level element in the form.
If you had repeat groups, you would have to specify the ordinal (1..n) of
the repeat group. So for the first repeat group, you would have:

I have tried composing that link by assembling the following elements:

form id: I find this in my XML file / or in my XLS file @ the settings tab.

version and uiVersion: I found this by looking at the database table >
columns _model_version and _ui_version

*the name of the top element in the form: I am completely lost here..... *

primary key: I take this from the _URI column in my CORE table.

Xpath within the form: I am also lost here....

It would be great if someone could help me in the right direction.

Enclosed is the xml file with my test form.

Thanks a lot for all help!

Eagle.

SignaturTest2.xml (1.25 KB)

The easiest way to play around with and understand this is to look at the
URL for the small image snippets in one of your submitted forms. e.g., on
https://opendatakit.appspot.com , select the Miramare
form on the Submissions tab, then click one of the View buttons to see the
repeat group for one of these submissions. If you scroll right in the
pop-up, the submitter may have provided an image. Right-click on that,
choose to Copy the URL for the image, and then paste it into an editor to
see what it looks like.

e.g.,

https://opendatakit.appspot.com/view/binaryData?blobKey=Miramare[%40version%3Dnull+and+%40uiVersion%3Dnull]%2Fnm[%40key%3Duuid%3A15287090-3ca6-4791-8485-e8c7a7a53b40]%2Frepeat_observation[%40ordinal%3D1]%2Fimage&previewImage=true

Clip out the blobKey= value (up until the &) and URL decode it using any of
the decoders available on the web (e.g.,
http://meyerweb.com/eric/tools/dencoder/ )

For the above, this gives:

Miramare[@version=null and
@uiVersion=null]/nm[@key=uuid:15287090-3ca6-4791-8485-e8c7a7a53b40]/repeat_observation[@ordinal=1]/image

You can then match up the XPath elements with the elements in your form
definition. e.g., in this case:

https://opendatakit.appspot.com/formXml?formId=Miramare

ยทยทยท On Thu, Jan 5, 2017 at 7:45 AM, eagle wrote:

I am struggling with understanding how to pull images from the database,
as described here
https://groups.google.com/forum/#!topic/opendatakit/uzMy9az9eGE.

From that thread :

The blobKey identifies the image. As with all URLs, the parameters are
URLEncoded which makes them very ugly. The URLDecoded blobKey looks like:

geo_tagger_v2[@version=null and @uiVersion=null]/geotagger[@
key=uuid:f6454ba6-2485-426f-8e1a-8981e463e6fe]/Image

This is an XPath-style naming for the image element in the Xform. It
identifies the form id: get_tagger_v2, the version and uiVersion values
(from the attributes on the Xform's top-level element), the name of the
top-level element in the form (geotagger), the primary key for the
submission being referenced (uuid:f6454ba6-2485-426f-8e1a-8981e463e6fe)
and the XPath within the form to the image. In this case, the image (field
name Image) is immediately underneath the top-level element in the form.
If you had repeat groups, you would have to specify the ordinal (1..n) of
the repeat group. So for the first repeat group, you would have:

I have tried composing that link by assembling the following elements:

form id: I find this in my XML file / or in my XLS file @ the settings tab.

version and uiVersion: I found this by looking at the database table >
columns _model_version and _ui_version

*the name of the top element in the form: I am completely lost here..... *

primary key: I take this from the _URI column in my CORE table.

Xpath within the form: I am also lost here....

It would be great if someone could help me in the right direction.

Enclosed is the xml file with my test form.

Thanks a lot for all help!

Eagle.

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google Groups
"ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com

Thanks a lot, Mitch! That helped getting it solved.

As reference for others, this is what I did:

How to get images out of ODK Aggregate MySQL databae:

  1. Log into ODK Aggregate as admin > Site Admin / Configure Site Access.

At the bottom check "Allow anonymous retrieval of images, audio and video
data (needed for GoogleEarth balloon displays)" & save page.

  1. In ODK Aggregate switch to "Submissions" and select the appropriate
    form.

  2. Find a submission that has an image and click on that image (it opens in
    a separate window).

  3. Right click that image and copy the URL for the image.

  4. Run that URL through a urldecoder
    http://meyerweb.com/eric/tools/dencoder/.

  5. Now I can just replace the key (uuid:nnnnnn) taken from the _URI column
    in the CORE table, and download the image.

Thanks again for all help!

eagle.