Can we hotlink ODK Central media files?

1. What is the problem? Be very detailed.
I would like to hotlink media attachments hosted in ODK Central in the same way it was possible on ODK Aggregate. This would allow me to include attachments in data previews without having to download and then host them myself. (Auto-deployed pkgdown GitHub pages are a royal pain with custom resource files).

In order to hotlink attachments, the attachment URL for a media attachment would need to be made public (disabled authentication). This could be an opt-in setting in the forms tab.

2. What app or server are you using and on what device and operating system? Include version numbers.
ODK Central 0.6

3. What you have you tried to fix the problem?

  • I can access any media via its attachment URL from an authenticated browser session.
  • I get a solid 403 when accessing an attachment URL from an unauthenticated browser session.

4. What steps can we take to reproduce the problem?

  • Access any attachment URL from an (un-)authenticated browser session.

5. Anything else we should know or have? If you have a test form or screenshots or logs, attach below.
This is an example of a preview of ODK Central submissions which would benefit from hotlinking attachments.
Seeing that submission data is tiny compared to attachment file sizes, this would make previews pretty light-weight.

Discussion on ODK Central GH issue: https://github.com/opendatakit/central/issues/43

hey @Florian_May: i think this is a totally reasonable request as an optional toggle but not as the server default. everyone on the team figures this will happen for you at some point, we just don't know when yet; we're dealing with a lot of pretty major blocks of work on multiple tools right now.

3 Likes

Great to hear, that's perfectly fine! Secure by default and opt-in to make attachments public (per form) would be great.
In the meantime I found the correct incantations to host ODK attachments in CI-deployed R package docs (map popups and table details).

Hi all

What I want? Import image from forms into QGIS.
Why It´s an essential feature, when planning from office that user can se the image.

I´m sure back in time when we used Aggregate connected to Google Fusion Tables an public url was included in the table data. Now I´m looking at similar options in Central and going trough our data output from Odata. The data dont´reflect any public and absolute path to images from the forms?

Is it possible to get or is this a feature request?

  • Morck

Hi @Morck!

OData exports the image filename, which you can use to construct a URL:

Is that what you had in mind?

Note that the URL is not publicly accessible: the user must have authenticated to view the URL.

Hi @Matthew_White

Thanks for looking into this. No, it´s not. It was the public version I´m after without auth so it can be loaded into an html box in QGIS. And I found out that this is yet not possible.

Ah interesting. In general, we expect downstream visualization tools to be able to securely auth against the server. Does QGIS have an authentication mechanism?

I hope to do it without auth, while our setup would be a LAN behind a firewall. But yes qgis has. Look for chapter 20.1: https://docs.qgis.org/3.10/en/docs/user_manual/auth_system/auth_overview.html

If QGIS has an auth mechanism, I think I would recommend using that to connect to Central. Are there challenges or downsides in taking that approach? For example, are there QGIS features that wouldn't be available that way? It'd be very helpful to get as much detail as possible!

1 Like

I can´t tell if there is, but I´ll ask in to the community if there is. Haven´t used it myseff. I will notify in here what I find out, ok.

3 Likes

The only working option I see is 0Auth2 - and I can´t tell if it will work as expected. Secondly this will require ODK to develop this feature server-side generating and validating tokens. Basic auth is not an option exposing user credentials.

An option within Central easily making selected images public would be preffered. A workaround could be to expose the dir (or clone) where the images are saved and by that build and absolute url to the image, while the image id is known.

If this was possbile then form data could be viewed in QGIS like this - here with mouse over:

1 Like

Thanks @yanokwa for merging this discussion with the existing feature request!

And thanks @Morck for looking more into this. It sounds like this is functionality that we'll want to add to Central. I also wanted to ask another question about your use case:

Does this mean that there will be users viewing your QGIS output who won't have access to your Central installation? And that if you used basic auth, QGIS would allow these users to view the Central credentials?

Central actually stores images and other submission attachments in the database. However, if you download the submissions .zip file, it will contain the images.

1 Like

Hi to all, really interesting to read on that. We tried to implement such a workaround, extracting binary data to files in a minio server to get a public url for each file stored in the database. We do not matter about authentication because taken pictures are not sensitive.
It is just a "tricky" workaround :frowning: . And a more direct access to stored files would be really usefull !

Maybe a discussion on QGIS side about accessing OData standard API would be interesting, as it tend to be more and more use on Data portals...

2 Likes

I don´t think that it will conflict with acces to Central no. And to your second question. No they won´t, but from a perspective regarding security I´m just not fan of sharing credentials to an application over https. With use of tokens to a specific service, this can be avoided. But the best option would be a public link. As in @mathieubossaert case, our pictures are not sensitive. And as admin sharing this public url will make sharing with multiple users much easier. That said, I can´t reject that there are cases where certain pictures shouldn´t be public. I´m imagining an interface within in central where pictures can be selected in one click. Specific pictures that the user won´t share public can be clicked off one by one.

1 Like

Ok so here´s another update. My GIS-community just gave me this hint: https://public.cloudmergin.com/.
I´ve tried it out and it does exactly what I´m requesting:

  1. Publishes images publicly so any other application can link to the image urls
  2. Supports setting GPS location manually by map interface - an essentiel feature, when precise locations are needed(GeoODK app supported this - now deprecated)

As a professionel QGIS user it has the big advantage that user can define the forms and projects within QGIS and then synchronice with server and vice verca. I know that ODK is reaching for a broader field than GIS-users, but in our case this almost fullfills our needs. That said Mergin has many limitations compared to ODK. Take a look at it and get inspired. There´s a free version up to 100 mb storage.

3 posts were split to a new topic: Connecting Central to ReDash dashboard

I've made a sort of proxy to do this with PHP. It only does jpegs and isn't perfect - I'm not a programmer.

It does allow hotlinking to images via the API though.

Post here.

1 Like

The updated php method I adapted now works in QGIS.

If you get the streaming of images working as per my post then you can add a field to your QGIS layer with the following calculation (new text field):

concat('index.php?pid=[your_project_id]&xmlfid=[your_form_id]&parentkey=', "PARENT_KEY",'&filenm=', "[the_image_field]" )

Then in your form set that field to the type "Attachment" and the default path to be your web folder that you've placed the php files.

Set the Integrated Document Viewer to Web Content and when you 'identify' the point, the form will open and load the image directly from ODK Central.

Note that it doesn't resize! Yet.